Check OS Version in Linux

Linux is an open-source and free operating system. There are various Linux versions available for their users. Typically, they are known as Linux distribution. RHEL, Fedora, Arch, CentOS, Ubuntu, Debian, OpenSUSE, Suse all are basic names of Linux distribution. Knowing the name and version of our Linux distribution can be very helpful for many patches of security.

For a user and administrator of Linux, it is important to know the version of their operating system. There can be many causes to know the version number of our operating system. It could be very useful if we are going to install any new program, authenticating the availability of several features and troubleshooting purposes.

There are so many ways available with which we can obtain the version of our operating system. Further, we will discuss both command line and graphical ways to check the operating system's version of our Linux system.

Check Operating System Version By Terminal

Below are a few ways of command line from which we can view the version of our operating system in our system. Open the terminal and find the Terminal application in the search bar. Press on the Terminal icon to open when it appears.

How to Check Linux Version

To find the version and name of the operating system in Linux, the procedure is as follows:

  • Open the command line application (terminal)
  • We can log in for a remote user using the following command:
  • Enter any one of the below commands for finding the version and name of the operating system:
  • Enter the below command for finding the version of the Linux kernel:

Let's explain each of the examples for basic Linux distributions.

/etc/os-release file

This file can be defined as a configuration file. It is the systemd package's part that includes identification data for the operating system. We will find the /etc/os-release command only inside the current distribution of Linux.

Using this command, we can get the information of the version of our operating system. We can run the below command for displaying the os-release file's contents:


Check OS Version in Linux

Also, we can filter out the details like the name and version of the operating system with the help of the egrep command or grep command as follows:


Check OS Version in Linux

Check OS Version in Linux

The above values are also explained as follows:

Name: It is a distribution. However, if it is not set, it might only show "Linux".

Version: It is the version of the operating system.

ID: It is the operating system's lowercase string version.

ID_Like: This field would include the parent distribution if a distribution is the derivative of another.

Pretty_Name: It is the version and name of the distribution in the simple and straightforward string.

Version_ID: It is the version number of the distribution.

Home_URL: It is the home page of the distribution project.

Support_URL: It is the primary support page of the distribution.

Bug_Report_URL: It is the primary bug reporting page of the distribution.

Privacy_Policy_URL: It is the primary privacy policy page of the distribution.

Version_Codename: It is the external code name of the version.

Ubuntu_Codename: It is an Ubuntu-specific section and it includes the internal code name of the version.

lsb_release command

This command provides distribution and Linux Standard Base based (in short LSB) details on the CLI. The lsb_release command permits us to find LSB details about the distribution of Linux that contains release number, distributor ID, and codename.

This command may be missing from our system in a few Linux distros due to minimal installation of the operating system or any other causes. In that condition, if we execute this command, we might get an error message like "No LSB modules are available".

First, we need to install the lsb_release package with the help of apt-get for solving this issue:


Check OS Version in Linux

Then, we can run the below command to view the OS version with other details:


Check OS Version in Linux

If we wish to print out the information of the version rather than the whole information of LSB, we can apply the lsb_release along with the -d option. The example is mentioned as follows:


Check OS Version in Linux

The above command will only print a description line representing the number of the version:

hostnamectl command

Also, this command is the systemd package's part. It is generally used for checking and modifying the hostname. But, we can also apply it for checking the version of our operating system.

Same as the /etc/os-release command, this command works on the current distributions of Linux as well. It can be used to change and query the system hostname and settings.

For using the hostnamectl command to view the version of the operating system, we can run the below command:

Check OS Version in Linux

/etc/issue file

In this file, the text of system identification is stored. It is shown before the prompts of log in. Normally, the /etc/issue file includes information about the version of Linux which we can view with the help of the cat command.


Check OS Version in Linux

This command just shows the number of our OS versions. But, if we wish to know the version of our OS along with the point releases, we can type the below command:


Check OS Version in Linux

/etc/*release file

In case, if no above commands are working for us, most likely, we are running a very outdated and old distribution of Linux. In this situation, we can apply a command which will print the information of the version file and distribution release. This command is mentioned as follows:


Check OS Version in Linux

Check OS Version in Linux

Check Version of Kernel

If we wish to search the kernel version of our system with the operating system version, a few ways of the command line are mentioned below for doing so:

uname command

If we would like to check more details (for example, about computer architecture), then we can type the command which is mentioned below:


Check OS Version in Linux

This command is used for displaying the common information of a system. We can apply the -r option for finding the version of the kernel as follows:


Check OS Version in Linux

We will get the result same as follows:

We can see the kernel of Linux from the above result that we're running is 4.19.0-5-amd64.

In which,

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

dmesg command

Generally, the dmesg command is used for examining the messages of kernel boot and for debugging hardware-related issues. But, we can use also it for checking the kernel version. We will need to pipe the dmesg along with a command, i.e., grep command to view the information of the kernel which is mentioned below:


Check OS Version in Linux

We will find the version of the kernel within the first line of our output:

/proc/version

Also, this file includes information about the Linux kernel. We can use the below command for viewing this file in the terminal:


Check OS Version in Linux

Also, we will find the version of the kernel within the first line of our output:

Check Operating System Version By GUI

We need to follow the following steps for checking the version of the operating system using the graphical user interface:

Step 1: We will need to first go to the Settings Utility in our system. To do it, we need to right-click on our desktop and select Settings as displayed in the below screenshot:

Check OS Version in Linux

Also, we can find the Settings utility through the Application Menu. Press the super key on our keyboard and within the search bar enter Settings. Click on the Settings icon to open when it appears.

Check OS Version in Linux

Step 2: Select the About tab as displayed in the below screenshot inside the Settings Utility:

By default, the below window will occur in the About view when we press on the Details tab. Here, we will search our OS version. Also, we will find any other details apart from the details of the version such as disk size, OS type, graphics, processor, memory, etc.

Check OS Version in Linux