What Version Of Red Hat Enterprise Linux (RHEL) Am I Running?

last updated in Categories , ,

I am a new Red Hat Enterprise Linux user. How do I find out what version of RHEL am I using from the shell prompt? How do you check Redhat version using command line?

To display Red hat version use any one of the following command/method to find our your Red Hat Enterprise Linux server version.

  1. lsb_release command
  2. /etc/redhat-release file
  3. /etc/issue file
  4. /etc/os-release file
  5. hostnamectl command (only works on RHEL 7.x)

Find RHEL version using /etc/redhat-release file

Type the following cat command to display the contents of a file called /etc/redhat-release:
$ cat /etc/redhat-release
Sample outputs:

Red Hat Enterprise Linux Server release 6.5 (Santiago)

In this example, I am using RHEL version 6.5.

How to display RedHat Enterprise Linux version using /etc/os-release

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

NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"
PRETTY_NAME="Red Hat Enterprise Linux"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"

Determine what version of Red Hat Enterprise Linux is running using lsb_release command

You need to install a package called redhat-lsb-core using yum command:
$ sudo yum install redhat-lsb-core
Sample outputs:

Loaded plugins: product-id, protectbase, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6 will be installed
epel/filelists_db                                        | 8.1 MB     00:02     
ksplice-uptrack/filelists                                | 2.2 kB     00:00     
rhel-x86_64-server-6/filelists                           |  28 MB     00:04     
rhel-x86_64-server-6-debuginfo/filelists                 |  38 MB     00:05     
rhel-x86_64-server-optional-6/filelists                  |  10 MB     00:01     
rhel-x86_64-server-optional-6-debuginfo/filelists        |  34 MB     00:05     
rhel-x86_64-server-supplementary-6/filelists             | 1.5 MB     00:00     
rhel-x86_64-server-supplementary-6-debuginfo/filelists   |  863 B     00:00     
--> Processing Dependency: perl-Test-Simple for package: redhat-lsb-core-4.0-7.el6.x86_64
--> Processing Dependency: perl-CGI for package: redhat-lsb-core-4.0-7.el6.x86_64
--> Processing Dependency: /usr/bin/pax for package: redhat-lsb-core-4.0-7.el6.x86_64
--> Processing Dependency: /usr/bin/patch for package: redhat-lsb-core-4.0-7.el6.x86_64
--> Processing Dependency: /bin/gettext for package: redhat-lsb-core-4.0-7.el6.x86_64
--> Processing Dependency: /usr/bin/msgfmt for package: redhat-lsb-core-4.0-7.el6.x86_64
--> Running transaction check
---> Package gettext.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: cvs for package: gettext-0.17-16.el6.x86_64
---> Package patch.x86_64 0:2.6-6.el6 will be installed
---> Package pax.x86_64 0:3.4-10.1.el6 will be installed
---> Package perl-CGI.x86_64 0:3.51-136.el6 will be installed
---> Package perl-Test-Simple.x86_64 0:0.92-136.el6 will be installed
--> Running transaction check
---> Package cvs.x86_64 0:1.11.23-16.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
 Package             Arch      Version            Repository               Size
 redhat-lsb-core     x86_64    4.0-7.el6          rhel-x86_64-server-6     25 k
Installing for dependencies:
 cvs                 x86_64    1.11.23-16.el6     rhel-x86_64-server-6    712 k
 gettext             x86_64    0.17-16.el6        rhel-x86_64-server-6    1.8 M
 patch               x86_64    2.6-6.el6          rhel-x86_64-server-6     91 k
 pax                 x86_64    3.4-10.1.el6       rhel-x86_64-server-6     69 k
 perl-CGI            x86_64    3.51-136.el6       rhel-x86_64-server-6    209 k
 perl-Test-Simple    x86_64    0.92-136.el6       rhel-x86_64-server-6    112 k
Transaction Summary
Install       7 Package(s)
Total download size: 3.0 M
Installed size: 0  
Is this ok [y/N]: y
Downloading Packages:
(1/7): cvs-1.11.23-16.el6.x86_64.rpm                     | 712 kB     00:00     
(2/7): gettext-0.17-16.el6.x86_64.rpm                    | 1.8 MB     00:00     
(3/7): patch-2.6-6.el6.x86_64.rpm                        |  91 kB     00:00     
(4/7): pax-3.4-10.1.el6.x86_64.rpm                       |  69 kB     00:00     
(5/7): perl-CGI-3.51-136.el6.x86_64.rpm                  | 209 kB     00:00     
(6/7): perl-Test-Simple-0.92-136.el6.x86_64.rpm          | 112 kB     00:00     
(7/7): redhat-lsb-core-4.0-7.el6.x86_64.rpm              |  25 kB     00:00     
Total                                           3.1 MB/s | 3.0 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : cvs-1.11.23-16.el6.x86_64                                    1/7 
  Installing : gettext-0.17-16.el6.x86_64                                   2/7 
  Installing : perl-Test-Simple-0.92-136.el6.x86_64                         3/7 
  Installing : pax-3.4-10.1.el6.x86_64                                      4/7 
  Installing : perl-CGI-3.51-136.el6.x86_64                                 5/7 
  Installing : patch-2.6-6.el6.x86_64                                       6/7 
  Installing : redhat-lsb-core-4.0-7.el6.x86_64                             7/7 
  Verifying  : patch-2.6-6.el6.x86_64                                       1/7 
  Verifying  : perl-CGI-3.51-136.el6.x86_64                                 2/7 
  Verifying  : redhat-lsb-core-4.0-7.el6.x86_64                             3/7 
  Verifying  : pax-3.4-10.1.el6.x86_64                                      4/7 
  Verifying  : gettext-0.17-16.el6.x86_64                                   5/7 
  Verifying  : perl-Test-Simple-0.92-136.el6.x86_64                         6/7 
  Verifying  : cvs-1.11.23-16.el6.x86_64                                    7/7 
  redhat-lsb-core.x86_64 0:4.0-7.el6                                            
Dependency Installed:
  cvs.x86_64 0:1.11.23-16.el6        gettext.x86_64 0:0.17-16.el6              
  patch.x86_64 0:2.6-6.el6           pax.x86_64 0:3.4-10.1.el6                 
  perl-CGI.x86_64 0:3.51-136.el6     perl-Test-Simple.x86_64 0:0.92-136.el6    

Now type the following command:
$ lsb_release -a
Sample outputs:

Fig.01: Finding out RHEL version
Fig.01: Finding out RHEL version

Finding RHEL release and version using /etc/issue file

Type the following cat command:
$ cat /etc/issue
Sample outputs:

Red Hat Enterprise Linux Server release 6.5 (Santiago)
Kernel \r on an \m

How to check Redhat version using hostnamectl command

Type the following hostnamectl command (only works on RHEL 7.x or above):
$ hostnamectl
Sample outputs:
How to check Redhat enterprise linux version

Related media

This tutorials is also available in a quick video format:

Video 01: What Version Of Linux Am I Running?

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!