5 Easy Ways To Check Linux OS Version | Arkit

There are many other ways to check Linux OS Version, Here are 5 easy ways to check Linux OS version using below commands. These commands works across on all Linux platforms

Check Linux OS Version

LSB stands for Linux Standard Base

# lsb_release
bash: lsb_release: command not found

if lsb_release not found then install require packages and try again

# yum install redhat-lsb-core

# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.6.1810 (Core)
Release: 7.6.1810
Codename: Core

# lsb_release -d
Description: CentOS Linux release 7.6.1810 (Core)

# lsb_release -a -s
:core-4.1-amd64:core-4.1-noarch CentOS "CentOS Linux release 7.6.1810 (Core) " 7.6.1810 Core

Method-2 Linux OS Version Details

For all Centos/Red Hat versions there is an file in /etc/distribution-release which contains version information as shown below

# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

# cat /etc/*-release
CentOS Linux release 7.6.1810 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID_LIKE="rhel fedora"
PRETTY_NAME="CentOS Linux 7 (Core)"


CentOS Linux release 7.6.1810 (Core)
CentOS Linux release 7.6.1810 (Core)


Latest versions of Centos / Red Hat Linux we also use hostnamectl command to find Linux OS version

# hostnamectl
Static hostname: rhel7
Icon name: computer-vm
Chassis: vm
Machine ID: 77c02f73e2e7401a8f9a07a8b9fd4c9e
Boot ID: 133f40eb9dc743a9b0f9189ca6be97ac
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.21.1.el7.x86_64
Architecture: x86-64


Using installed centos-release RPM package you can identify

rpm -q centos-release

Method-5 Simple Python Script

simple python script which will let you know installed version of Linux


import platform
print platform.linux_distribution()

# python version.py
('CentOS Linux', '7.6.1810', 'Core')

last but not least uname command can also let you know Linux OS Version

uname -r

Here el7 = Enterprise Linux version 7

Related Articles

Create RHV-M User

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published. Required fields are marked *