How to Check OS Version From Command Line?

Linux is a well-reputed and commonly used operating system. It provides a lot of distributions such as  RedHat, Ubuntu, CentOS, Fedora, and many others. It is recommended to check the version of Linux OS time by time as it helps in multiple situations, i.e., getting the version-specific applications/packages, checking if the system’s version is updated, and much more.

This article illustrates the possible methods for checking the OS version from the command line. The content of this article is specified below:

Let’s start with the “lsb_release” command.

Method 1: Use the “lsb_release” Command to Check OS Version

The purpose of the “lsb_release” command is to show the basic information about the Linux operating system. Moreover, the “lsb_release” command contains a list of supported options.

From these options, the “-a” option provides the entire Linux distribution’s information, such as Version, Description, Release, and codename.

Run the below-mentioned command in the console(Ctrl+Alt+T) to check the current OS version:

$ lsb_release -a

The current Ubuntu OS version is “22.04”.

To display only one specified information, use the “-d” flag of the “lsb_release” command:

$ lsb_release -d

Method 2: Use the “hostnamectl” Command to Check OS Version

The “hostnamectl” is another command line tool that tells the information of a particular system including its hostname and much more. Furthermore, it also allows the user to make some changes.

In this method, it is used to check the current operating system version by utilizing the following command:

$ hostnamectl

The “homenamectl” command displays the report mentioned in the above screenshot. The output contains the “hostname”, “chassis type (desktop)”, “OS version”, and much more.

Method 3: Use the “uname” Command to Check OS Kernel Version

The “uname” command is another GNU utility that tells the information about the Linux distro. It is the same as the “hostname” and the “lsb_release” commands but differs in that the output.

Execute the “uname” command with its “-a” flag that will print the entire system all information as shown below:

$ uname -a

The highlighted section in the output displays the current system “kernel” version.

To get only the specific detail about the system,  run the “uname” command with the “-v” flag. It will display only the kernel version:

$ uname -v

Method 4: Use the “os-release” File to Check OS Version

Here is another useful method to check the entire Linux system. The “/etc/os-release” file contains the “os-release” file that holds the operating system information like “VERSION_ID”, “VERSION”, “NAME”, and much more.

Use the “cat” command to list the operating system version information stored in the “os-release” file.

$ cat /etc/os-release

The output displays the current operating system version “22.04 (Jammy Jellyfish)”.

Tip: To get a detailed view of OS version information, use the below-mentioned command:

$ cat /etc/*release

The “*(asterik)” displays the complete information of the current Linux distribution available in the “/etc/release” location.

Tip: To check only the specific operating system “name” and “version” before prompt login, type the following command in the console:

$ cat /etc/issue

Method 5: Use the “/proc/version” FileSystem to Check Kernel Version

The “proc” directory is a virtual file system also called the “proc file system”. It is created dynamically. It provides different types of hardware and running process information of the system.

Use the below “cat” command to check the current system kernel version:

$ cat /proc/version

The current OS version is “Ubuntu 22.04”.

That’s all the possible ways to check the OS version from the command line.


To check the OS version, use the “lsb_release”, “hostnamectl”, and the “uname” command. Furthermore, the filesystem “os-release” also provides the operating system version information. Another file system called “/proc/version” can also be used to check the OS version. This article has demonstrated all the possible methods for checking the OS version using the command line.