How to Check your Linux OS Version

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

Linux is a most popular open source OS used widely on many systems, servers and other machines like Raspberry Pi, etc. There are many variants out there in Linux which are known as distributions. The most common distributions are Ubuntu, Debian, SUSE, Mint, CentOS, Redhat, ArcLinux and many more.

It is better to know the version of your operating system when you update or install packages or installing security patches, etc.

Some distributions like Ubuntu, Debian shows the version of the OS when you login as a welcome message. But this can be disabled manually.

In this guide you going to learn how to identify your Linux OS and the version installed on your machine.

There are many methods available out there to check the OS and version.

Using lsb_release command

This is the first command you want to try while identifying the installed OS and version. Most recent Linux distributions have this package installed which supports this command. LSB stands for Linux Standard Base which displays the basic information we need to know.

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

Using os-release file

Every Linux distributions have a os-release file inside the etc directory. This file contains the detailed information of the operating system.

cat /etc/os-release
VERSION="20.04.3 LTS (Focal Fossa)"
PRETTY_NAME="Ubuntu 20.04.3 LTS"

You can use the grep command to filter out the version line alone.

grep 'VERSION' /etc/os-release

Using hostnamectl

hostnamectl is a tool to Control Linux System Hostname. This command outputs the hostname along with other system related details.

Now we can use grep to filter the output to display only the Operating system details.

hostnamectl | grep "Operating"
Operating System: Ubuntu 20.04.3 LTS

Using proc file

The proc directory has a version file which outputs the OS release information. This file doesn’t outputs the OS version, but with the information you can find the version of your distribution.

cat /proc/version
Linux version 5.11.0-1020-gcp ([email protected]) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #22~20.04.1-Ubuntu SMP Tue Sep 21 10:54:26 UTC 2021


Now you have learned how to identify the OS version of your Linux machine.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.