At one point or another, we might have faced a situation where are required to check the Linux version that is installed on a Linux server. So is there a way to check what Linux version are we using? If yes then how to check the Linux OS version?

In this tutorial, we are going to discuss just that. And we will discuss not one but 4 ways to check the Linux version that is installed on your systems.

Commands to check the Linux OS version, 

  1. /etc/os-release or /usr/lib/os-release
  2. lsb_release
  3. hostnamectl
  4. /etc/issue

Let’s discuss these methods/commands on how to check the Linux version one by one in a bit of detail.

Recommended Read: 5 ways to add or change hostname in CentOS 7

Also Read: How to change Date & Time in Linux

How to check Linux OS version

 1- /etc/os-release or /usr/lib/os-release

/etc/os-release or /usr/lib/os-release, both these files contains data related to operating system identification. /etc/os-release is the main file to refer  but in case its not available then /usr/lib/os-release is used. 

To check the Linux version, execute the following command,

# cat /etc/os-release


# cat /usr/lib/os-release

This command will show the following output,

how to check linux os version


2- lsb_release command

The next command on the list is lsb_release. This command shows Linux Standard Base or LSB information about specific Linux distribution with information like version number, release codename, and distributor ID, etc.

To check the OS version in Linux, execute the following command, 

# lsb_release -a

And you will get the following output,

how to check linux os version


3- Hostnamectl

Hostnamectl command shows the current hostname of the system as well as system-related information. To get the information, run

# hostnamectl

Along with the hostname & operating system version, we will also get information like machine-id, boot-id, architecture, etc.


4- /etc/issue

This is another file located on Linux systems that can help us identify the os version installed in Linux systems. Basically, this file contains a message or system identification information to be printed before the login prompt & can be used to identity the os version as well.

Use the following command,

# cat /etc/issue

& you would get the following output,

how to check linux os version

That’s it guys, these were the 4 ways using which we can identify the OS versions installed on the Linux system. If you guys have any issues or queries regarding this tutorial, then please do let us know using the comment box below.

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean - 100$ free credit & Linode - 100$ free credit

Check some Exclusive Deals, HERE.

Also, check out DevOps Book You should read section.