How to Check OS Version in Linux with Command Line

Check OS Version in Linux with Command-Line

Linux is opensource and free operating system available today. There are different and many distributions of Linux available. Ubuntu, Debian, Manjaro, Fedora, OpenSuse, RHEL, CentOS and Linux Mint, etc. are the popular Linux variants. When installing software packages and security patches the operating system version is important. In this tutorial, we are going to learn how to check the OS version in Linux with Command-Line.

Check OS Version in Linux

You can check OS version by using the following lsb_release command:

lsb_release -a

uname can also be used to check OS version:

uname -r

By using hostnamectl the command can also be useful checking OS version:


The Operating-System related information is also stored inside /etc/os-release file, to display it use the following command:

cat /etc/os-release

Examples of checking OS version

Following are the examples with output data to show the version of the operating system version:

1. lsb_release Command

LSB stands for Linux Standard Base. The lsb_release command displays information of Linux Distribution. To check the OS version you can run following lsb_release Command:

lsb_release -a

The output should be:

LSB Version:	n/a
Distributor ID:	ManjaroLinux
Description:	Manjaro Linux
Release:	18.1.5
Codename:	Juhraya

2. uname Command

You can display Linux Kernel Architecture, version, name, etc. by using uname command:

uname -srvo

The output should be:

Linux 4.19.91-1-MANJARO #1 SMP Sat Dec 21 11:18:44 UTC 2019 GNU/Linux

Or to display only OS version type the following command:

uname -r

The output should be:


3. Using /etc/os-release File Data

The /etc/os-release file contains operating system related identification data. You can simply use the cat command to show the data of etc/os-release file data:

cat /etc/os-release

The output should be:

NAME="Manjaro Linux"
PRETTY_NAME="Manjaro Linux"

4. hostnamectl Utility

The hostnamectl utility is part of SystemD used for changing hostname, we can use this utility to display information about Linux Distribution.


The output should be:

   Static hostname: linux4one
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 9331e16a9f024d05ad3da354c679382c
           Boot ID: ffe54918cf9e4a8f9be10479ab5a2bec
  Operating System: Manjaro Linux
            Kernel: Linux 4.19.91-1-MANJARO
      Architecture: x86-64

5. /etc/*release File for Old Linux Distributions

If you are running a very old Linux Distro then maybe all the above methods will not work. So to check OS version on very old computers use the following command:

cat /etc/*release

or you can check the only version by using the following command:

cat /etc/*version


You have successfully learned How to Check OS Version in Linux with Command-Line. If you have any queries please don’t forget to comment out.