Home » How To » How to Check OS Version in Linux

How to Check OS Version in Linux

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.

Related:  Commands for Checking Memory Usage in Linux

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:

lsb_release -a 

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:

lsb_release -d 

How to check the Linux version from the “/etc/issue” file

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:

cat /etc/issue

How to check the Linux OS version from the “/etc/os-release” file

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.

Related:  How to Add a Directory to $PATH in Linux

To show the contents of the /etc/os-release file on the CLI use the below-given command.

cat /etc/os-release

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:

cat /etc/*release 

How to check the 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:

uname -srm

Leave a Comment