4 Ways to Check Redhat Version

The OS version of a Linux distribution can be determined by using the command-line interface as well as a graphical user interface.

In Linux, CLI is preferred over GUI as it provides more control over the OS.

In this article, we will mostly focus on the command line methods which can be used to check the Redhat version.

Commands to Check Redhat version

Here’s a quick summary of useful commands to check the Red Hat version:

  • cat /etc/os-release → Recommended (modern systems)
  • cat /etc/redhat-release → Works across many RHEL versions
  • uname -a → Kernel and system details
  • cat /proc/version → Kernel version, compiler, and build info
  • lsb_release -a → LSB standard details (may require installation)
  • hostnamectl → Shows OS version along with hardware details
  • cat /etc/issue → Login banner with version info

Check Redhat version from /etc/os-release

You can easily get Redhat version using cat /etc/os-release command.

All we need is to open the terminal and type cat /etc/os-release. It will list the Redhat OS distribution name and release version information.

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.4 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.4 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.4:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.4
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.4"

This is the most future-proof method and works on RHEL 7 and newer.

Check Redhat version with uname command

We can use uname command to check Redhat version.

See also: Mastering the Linux Command Line — Your Complete Free Training Guide

This command is used to print our redhat system information such as kernel version and release name, network hostname, machine hardware name, processor architecture, hardware platform and the operating system.

uname -a
Linux taurus-a-1.com 4.18.0-305.el8.x86_64 #1 SMP Thu Apr 29 08:54:30 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux

Pro tip: uname -r gives just the kernel release (e.g., 4.18.0-305.el8.x86_64).

Check Redhat version from /proc/version

Another way to check Redhat version is using cat /proc/version.

This command will list the version of the Linux kernel, the version of gcc, the Redhat version, and the time of kernel compilation.

Linux version 4.18.0-305.el8.x86_64 (mockbuild@x86-vm-07.build.eng.bos.redhat.com) (gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)) #1 SMP Thu Apr 29 08:54:30 EDT 2021

cat /etc/*release

  • ---------- On Red Hat Linux ----------

    $ cat /etc/redhat-release
  • ---------- On CentOS Linux ----------

    $ cat /etc/centos-release
  • ---------- On Fedora Linux ----------

    $ cat /etc/fedora-release
  • ---------- On Debian Linux ----------

    $ cat /etc/debian_version
  • ---------- On Ubuntu and Linux Mint ----------

    $ cat /etc/lsb-release
  • ---------- On Gentoo Linux ----------

    $ cat /etc/gentoo-release
  • ---------- On SuSE Linux ----------

    $ cat /etc/SuSE-release

Check Redhat version with /etc/redhat-release

This file is specific to Red Hat and provides a clean, human-readable version string:

cat /etc/redhat-release

Example:

Red Hat Enterprise Linux release 8.4 (Ootpa)

Other distributions have their own equivalents:

  • CentOS → /etc/centos-release
  • Fedora → /etc/fedora-release
  • Ubuntu → /etc/lsb-release
  • Debian → /etc/debian_version

This is useful if you manage mixed Linux environments.

Check Redhat version with lsb_release command

The lsb_release command is a helpful utility to find out information about our Linux installation. It displays LSB (Linux Standard Base) information about the Linux distribution.

lsb_release -a
Output
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

 

Troubleshooting: What If These Commands Don’t Work?

  • On very old RHEL systems (before 6), /etc/os-release might not exist. In that case, try /etc/redhat-release or /proc/version.
  • On minimal installations, some tools like lsb_release might not be available until you install them.
  • If you’re inside a container, you may only see base image info, not the host OS.
David Cao
David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

Articles: 275