Linux Initscript Example to start and stop process during booting

The below shell script uses start-stop-daemon from “/sbin/start-stop-daemon” to execute the program during booting so that the process is started boottime. In the below example, DAEMON=$PWD/helloworld.bin shows that our program is helloworld.bin and is located in current directory from where the script is executed. The above script can be executed as “bash start_daemon.sh start” to … Read more

What is Python ?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without … Read more

How to change python version in Ubuntu ?

If you have more than one python version installed like below, here, as you can see we have two python versions installed, python 2.7 and python 3.6. Lets check what is our current active python version, Now, lets say we want to change the python version from 2.7 to 3.6 , then for your current … Read more

Using conditional statements, if and if-else in Python

When you are writing python program, sometimes you need to make certain checks on variables and based on which you need to take some decisions.. this same is called as Decision making statements in C programming Language. In this post, we will show you how you can use simple conditional statements “if” and “if-else” As … Read more

How to concatenate strings in Python ?

When you are working with strings in python, at some point in time, you would definitely need to join two strings to make a new string. Which has both strings combined. we call this as concatenation of strings. If you are new to python, read our all python articles from python page. This post shows … Read more

Writing first python helloworld program

If you have following installation / development environment setup steps from python page, to install python ( preferably python3 since its latest version ) . Its now time to write very first python program obviously helloworld python. $ vim helloworld.py #!/usr/bin/env python print (“Hello World”) Here, we created a file helloworld.py , notice the extension … Read more

How to Install Python on Linux / Ubuntu ?

If you have just now started looking into python, the first thing you need to do is install python on your development machine. If you are working on Windows, please check our another post “How to install Python on Windows” This post helps you to install python on Ubuntu. Installation of Python 2 To install … Read more

How to clear Terminal / Shell history in Ubuntu / Linux ?

When you type something on linux shell, by default Linux save the commands what you type as history to “~/.bash_history” or /home/username/.bash_history file so that you can easily check what you have typed previously using “history” command. $ history | tail 1998 sudo apt-get install mdns 1999 sudo apt-get install mdns-scan 2000 sudo mdns-scan As … Read more

Multiple line comment in bash / shell script

In bash script, if we want to comment a single line, we just need to add # at the start of the line, like below [bash] #!/bin/bash # This is a comment echo "This is printed on terminal" [/bash] Now, but in certain scenarios we need to put multiple line comments, like some description of … Read more