Most people think of Linux as an operating system but it is actually a kernel; A kernel is a bridge between the software and hardware of a computer. Linux-based operating systems are actually called Linux distributions which usually include the Linux kernel along with software package managers, software, and graphical user interface.
It is important to always know the kernel and OS version of your system, especially if you’re an administrator. Knowing the version of your kernel and OS can help you determine which package manager to use to install new software and whether that software is supported by your system or not. It can also help in installing security patches and identifying the features available in your system.
The OS version of a Linux distribution can be determined by using the command-line interface as well as a graphical user interface. In Linux, CLI is preferred over GUI as it provides more control over the OS. In this article, we will mostly focus on the command line methods which can be used to check the OS version of a Linux distribution.
There are a number of different methods which can be used to determine the version of a Linux-based OS using the command-line interface.
How to Check Linux OS version using lsb_release
The lsb_release is a pre-installed utility in major Linux distributions which can be used to display the Linux Standard Base information on the command-line interface. Use the below-given command to determine the OS version of your system:
If it is not pre-installed in your OS, you can use your package manager to install this utility:
sudo apt install lsb-release
The apt is the package manager in Debian-based systems.
If you only want the version number instead of the whole LSB information then use the following command:
Check Linux version from the
The /etc/issue is a simple text file that has the identification information of the system. This information is printed on the screen before the login prompt. Use the below-given command to display the contents of the file on the command line interface:
Check Linux OS version from the
The /etc/os-release file contains all the information related to the operating system. It is a configuration file only included in the systemd package of the latest Linux distributions.
To show the contents of the
/etc/os-release file on the CLI use the below-given command.
Check Linux Version with hostnamectl command
The main purpose of the hostnamectl command is to change or check the host name; but this command can also be used to check the OS and Kernel version of the system:
How to Check OS Version on an Old Linux Systems
If you’re running a very old Linux distribution then you might not be able to use any of the above commands. Use the following command to know the OS version on your old system:
How to check Linux kernel version of the system by using the uname command
The uname command can be used to display the kernel version of your system on the terminal:
Output:Linux 5.4.0-73-generic x86_64
Knowing the OS and kernel version of your system is important as it keeps you informed about the updated features of your system. The OS version can also be checked using GUI if your Linux distribution has a desktop environment.
In this how-to guide, we learned to check the version of a Linux distribution using a command-line interface. We also learned to check the Kernel version of the system.