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:
Let's explain each of the examples for basic Linux distributions.
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:
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:
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.
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.
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:
Then, we can run the below command to view the OS version with other details:
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:
The above command will only print a description line representing the number of the version:
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:
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.
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:
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 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:
If we would like to check more details (for example, about computer architecture), then we can type the command which is mentioned below:
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:
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.
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:
We will find the version of the kernel within the first line of our output:
Also, this file includes information about the Linux kernel. We can use the below command for viewing this file in the terminal:
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:
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.
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.