There are different ways to find Linux RHEL version. RHEL stands for Red Hat Enterprise Linux.
How to find Linux RHEL version:
It’s essential to know the version of RHEL whenever you install any software on it because most of the old RHEL versions will not support the new package distributions.
1. RHEL version hostnamectl:
hostnamectl
– command gives about the more information on the host operating system and RHEL
# hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 0c82b28b3dbd44d0a5103fe5899b8e31
Boot ID: 49b60fe147674364b4afdce56926c312
Virtualization: microsoft
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1062.12.1.el7.x86_64
Architecture: x86-64
On the above output telling me, I am on CentOs operating system with RHEL 7 version and the Kernel version is Linux 3.10.0-1060.12.1.e17.x86_64
2. RHEL version redhat-release:
Another way to get RHEL version is by using a readhat-release
file.
#cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
It will give you a single line about the RHEL version so that you can grep it from shell program.
3. RHEL version redhat-lsb-core:
If you have already stalled redhat-lsb-core
on your machine, you can get the RHEL version using lsb_release
options.
# lsb_release -d
Description: CentOS Linux release 7.7.1908 (Core)
#lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.7.1908 (Core)
Release: 7.7.1908
Codename: Core
Happy Learning 🙂