How do I determine RHEL (Red Hat Enterprise Linux) version?

last updated in Categories ,

I am a new Linux sysadmin and user. I think we have five RHEL (Red Hat Enterprise Linux) Dell servers in our office. How do I determine the RHEL version? How do I find out RHEL kernel version from the ssh session created by putty.exe?

Introduction – Red Hat Enterprise Linux operating system created for enterprise customers. It is extremely popular among business users and sysadmin due to long-term support, stability and high-quality open source software. This page shows how to find out RHEL version from the command line.

How do I determine RHEL version?

To display the Red Hat Enterprise Linux version use any one of the following command/methods:

  1. To determine RHEL version, type: cat /etc/redhat-release
  2. Execute command to find RHEL version: more /etc/issue
  3. Show RHEL version using command line, rune: less /etc/os-release
  4. RHEL 7.x or above user can use the hostnamectl command to get RHEL version

Let us see all commands in details.

How to check RHEL / Redhat version

Type the following cat command:
cat /etc/redhat-release
Sample outputs:

Red Hat Enterprise Linux Server release 7.5 (Maipo)

To display the RHEL kernel version, type:
uname -r
uname -mrs

How to confirm RedHat Enterprise Linux version using hostnamectl

Simply run the following hostnamectl command:
hostnamectl
Sample outputs:

   Static hostname: nixcraft-rhel8
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 1a790a3f946c4936a2cb8dba207d19aa
           Boot ID: 58ebfde49964425ea754814b4ac54432
    Virtualization: kvm
  Operating System: Red Hat Enterprise Linux 8.0 Beta (Ootpa)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:8.0:beta
            Kernel: Linux 4.18.0-32.el8.x86_64
      Architecture: x86-64

Other commands to find out RHEL version

One can use the rpm command:
rpm --query redhat-release-server
Sample outputs:

redhat-release-server-7.5-8.el7.x86_64

Another option is to run lsb_release command. However, you need to install a package named redhat-lsb-core using the yum command as follows
sudo yum install redhat-lsb-core
## now get RHEL version ##
lsb_release -d
lsb_release -a

LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	RedHatEnterprise
Description:	Red Hat Enterprise Linux release 8.0 Beta (Ootpa)
Release:	8.0
Codename:	Ootpa

A sample session from my RHEL 7 server

Finding or determine RHEL version
Finding or determining RHEL server version using command line

Conclusion

This page showed you various RHEL command to find out your Redhat Enterprise Linux (RHEL) version.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

1 comment

    Still, have a question? Get help on our forum!