Utilities

How to Check the OS version in Linux

For a regular Linux user and especially administrator, knowing the version of the OS they are running is very important. There could be several reasons for knowing the version number of your OS. It can be very helpful when installing a new program, verifying the availability of various features and for troubleshooting purpose.

There are number of ways through which you can check the version of OS in a Linux system. In this article, we will explain both graphical and the command-line ways to obtain the OS version of a Linux system.

We have used Debian 10 OS for explaining the commands and methods mentioned in this article.

Check OS Version via Graphical User Interface

To check the OS version via the graphical user interface, follow the below steps:

Step 1: First, you will need to open the Settings utility in your system. To do so, right-click n your desktop and click Settings as shown in the following screenshot:

Alternatively, you can also search for the Settings utility from the Applications menu. Hit the super key on your keyboard and in the search bar type settings. When the Settings icon appears, click on it to open.

Step 2: In the Settings utility, go to the Details tab as shown in the following screenshot.

Step 3: When you click the Details tab, the following window will appear by default in About view. Here you will find the version of your OS which in our case is Debian 10. Apart from the version information, you will find some other information as well such as memory, processor, graphics, OS type, and disk size etc.

Check OS Version via Command-line Terminal

Following are some command-line ways through which you can view the OS version in your system.

Open the command line Terminal by hitting the super key on your keyboard and searching for the Terminal application by typing its keyword in the search bar. When the Terminal icon appears, click on it to open.

Using the lsb_release command

The lsb_release command allows you to find LSB (Linux Standard Base) information about your Linux distribution that includes release number, codename, and the distributor ID.

In some Linux distributions because of minimal installation of OS or some other reason, the lsb_release command might be missing from your system. In that case, if you run lsb_release command, you may receive the error “No LSB modules are available”.

To solve this issue, you have to first install lsb_release using the apt-get command as follows:

$ sudo apt-get install lsb-release

Once installed, you can then run the following lsb_release command in order to view the version of your OS along with other information:

$ lsb_release -a

From the below output, you can see the LSB information specific to our distribution that includes the release number or the version number of our OS that is Debian 10.

If you just want to print out the version information instead of whole LSB information, use lsb_release with the –d switch as follows:

$ lsb_release –dIt

will just print the description line showing the version number.

Using /etc/issue file

In /etc/issue file, system identification text is stored which is displayed before the login prompts. This file normally contains info about the Linux version which you can view using the cat command as follows:

$ cat /etc/issue

The above command only displays the version number of your OS. However, if you need to know the OS version with the point releases, enter the following command:

$ cat /etc/debian_version

Using /etc/os-release file

The /etc/ost-release file is a configuration file that is the part of the systemd package which contains OS identification data. You will find this command only in the latest Linux distribution. Using the /etc/os-release command, you can obtain the version information of your OS.

To display the contents of the os-release file, run the following command in Terminal:

$ cat /etc/os-release

Using hostnamectl command

The hostnamectl command is also a part of the systemd package. Generally, it is used to check and modify the hostname. However, you can also use it to check the version of your OS. Similar to the above command, hostnamectl command also works on the latest Linux distributions.

To use this command for viewing the OS version, run the following command in Terminal:

$ hostnamectl

Check Kernel version

If you want to find out the kernel version of your system along with the OS version, following are some command-line ways to do so:

Using uname command

The uname command is used to display basic system information. To find the kernel version, you can use uname with –r option as follows:

$ uname –r

You will receive the output similar to this:

From the above output, you can see the Linux kernel that we are running is 4.19.0-5-amd64 where:

  • 4 is the kernel version
  • 19 is the major revision
  • 0 is the minor revision
  • 5 is the patch number
  • Amd64 is the architecture information

Using dmesg command

The dmesg command is generally used to examine kernel boot messages and to debug hardware-related problems. However, we can also use it to check the version of the kernel. Pipe the dmesg with the grep command as follows to view the kernel information:

$ sudo dmesg | grep Linux

You will find the kernel version in the first line of the output.

Using /proc/version

The /proc/version file also contains the Linux kernel information. To view this file, use the following command in Terminal:

$ cat /proc/version

You will see the output similar to the below screenshot displaying the kernel version in the first line.

Note: You can check Out Debian Latest versions including the old releases at the following official page:

https://www.debian.org/releases/

In this article, we have covered some ways including both the graphical and the command line through which you can view the version of OS as well as the version of kernel you are running on your system.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn.