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 Now, but in certain scenarios we need to put multiple line comments, like some description of what the script is for, OR just need to disable some section of code … Read more

Shell script to check if Android device is connected over USB

Android devices has a daemon adbd which helps it to get connected over USB using adb command on linux host. If you are doing some kind of automation such as taking logs or installing some applications from ubuntu command line, the very first thing we need to make sure if our device is connected and … Read more