How To Use Python On Linux

Python is an extremely versatile programming language and it comes pre-installed with most Linux distributions. However, to fully utilize its potential you need to know how to properly use it on a Linux environment. In this blog post, we will guide you on the basics of using Python on Linux.

Checking Python Installation

Most of the Linux distributions come with Python pre-installed. You can check the installed version of Python by opening your terminal and typing the following command:

python --version

If Python is installed on your system, this command will display the Python version. If not, you can install it using the package manager of your Linux distribution.

Installing Python

If Python is not installed, you will need to install it. This process varies depending on your Linux distribution. Here, we’ll show you how to install Python on Ubuntu:

sudo apt-get update
sudo apt-get install python3.6

Replace “python3.6” with the version you want to install.

Running a Python Program

To run a Python program, simply type “python” followed by the path to your Python file. For example:

python /home/user/

This will execute the Python script located at “/home/user/”.

Using Python Interactive Shell

Python comes with an interactive shell that you can access by typing “python” in your terminal and hitting enter. This is a great way to try out Python commands.


Python is a powerful tool for all kinds of programming, from web development to data analysis, machine learning, and more. Every Linux user should be familiar with it. Hopefully, this guide has helped you get started with Python on Linux.