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="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" CentOS Linux release 7.6.1810 (Core) CentOS Linux release 7.6.1810 (Core)
Method-3
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
Method-4
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
#!/usr/bin/python
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 3.10.0-693.21.1.el7.x86_64
Here el7 = Enterprise Linux version 7
Related Articles
Thanks for Your Wonderful Support and Encouragement
More than 40,000 techies are part of our ARKIT community. Join us today and keep learning Linux, Cloud, Storage, DevOps, and IT technologies.