How to Check Linux RHEL Version
Checking your Linux RHEL version is a common task that helps you understand your system better. Whether you are managing servers or just curious about your setup, knowing the exact version of Red Hat Enterprise Linux (RHEL) is important. It helps with software compatibility, security updates, and troubleshooting.
In this article, I’ll guide you through several easy methods to check your RHEL version. You don’t need to be a Linux expert to follow along. We’ll cover commands and files you can use, so you can quickly find your system’s version anytime.
Why Knowing Your RHEL Version Matters
Knowing your RHEL version is more than just curiosity. It affects how you manage your system and what software you can run. Here are some reasons why it’s important:
- Software Compatibility: Some applications require specific RHEL versions.
- Security Updates: Updates and patches depend on your version.
- Troubleshooting: Helps when seeking support or fixing issues.
- System Audits: Useful for compliance and documentation.
With these points in mind, let’s explore how to check your RHEL version easily.
Using the /etc/redhat-release File
One of the simplest ways to check your RHEL version is by reading the /etc/redhat-release file. This file contains a text string that shows the version and release information.
To check it, open your terminal and type:
cat /etc/redhat-release
You will see output like this:
Red Hat Enterprise Linux Server release 8.7 (Ootpa)
This tells you the major version (8), the minor version (7), and the codename (Ootpa). This method works on most RHEL systems and is quick to use.
Why Use /etc/redhat-release?
- It’s a standard file on RHEL systems.
- Easy to read and understand.
- No special permissions needed.
If you want a quick look without extra details, this is the best place to start.
Using the hostnamectl Command
Another modern and convenient way to check your RHEL version is with the hostnamectl command. This command is often used to manage system hostname but also shows OS information.
Run this command in your terminal:
hostnamectl
You’ll get output like:
Static hostname: myserver
Icon name: computer-server
Chassis: server
Machine ID: 1234567890abcdef
Boot ID: abcdef1234567890
Operating System: Red Hat Enterprise Linux 8.7 (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8.7:GA:server
Kernel: Linux 4.18.0-425.el8.x86_64
Architecture: x86-64
Look for the Operating System line to find your RHEL version. This method gives you additional system info, which can be handy.
Benefits of hostnamectl
- Shows detailed OS and hardware info.
- Useful for system administrators.
- Works on RHEL 7 and newer.
Using the lsb_release Command
The lsb_release command is part of the Linux Standard Base and provides distribution-specific information. It may not be installed by default on RHEL, but you can add it easily.
To check your RHEL version with lsb_release, run:
lsb_release -a
If the command is not found, install it first:
sudo yum install redhat-lsb-core
The output looks like this:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 8.7 (Ootpa)
Release: 8.7
Codename: Ootpa
This gives you a clear breakdown of your RHEL version and codename.
When to Use lsb_release
- When you want standardized Linux distribution info.
- Helpful for scripts that check OS versions.
- Requires installation on some RHEL systems.
Checking Version with /etc/os-release File
The /etc/os-release file is a universal file present on most Linux distributions, including RHEL. It contains detailed information about the OS in a key-value format.
To view it, run:
cat /etc/os-release
You’ll see something like:
NAME="Red Hat Enterprise Linux"
VERSION="8.7 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.7 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.7:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
Look for VERSION or PRETTY_NAME to find your RHEL version.
Advantages of /etc/os-release
- Standardized across many Linux distros.
- Easy to parse in scripts.
- Provides detailed OS metadata.
Using the rpm Command to Check Kernel and OS Packages
You can also check your RHEL version by querying installed packages with the rpm command. This is useful if you want to confirm the version of core packages.
Try:
rpm -q redhat-release
This will output something like:
redhat-release-8.7-1.el8.x86_64
This confirms the exact package version of your RHEL release.
You can also check the kernel version with:
uname -r
Example output:
4.18.0-425.el8.x86_64
This shows the kernel version, which can be important for compatibility.
When to Use rpm and uname
- To verify installed package versions.
- When troubleshooting package-related issues.
- To check kernel version separately.
Using the /proc/version File
The /proc/version file contains kernel version and build info. It’s less specific about RHEL version but gives useful kernel details.
Check it with:
cat /proc/version
Example output:
Linux version 4.18.0-425.el8.x86_64 (mockbuild@x86-02.bsys.centos.org) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-5) (GCC)) #1 SMP Tue Sep 14 12:34:56 UTC 2026
This shows kernel build info and compiler details.
When to Use /proc/version
- To get kernel build and compiler info.
- Useful for debugging kernel-related problems.
- Not recommended for checking exact RHEL version.
Summary Table of Commands to Check RHEL Version
| Command/File | Description | Output Example |
cat /etc/redhat-release | Shows RHEL release version | Red Hat Enterprise Linux Server release 8.7 (Ootpa) |
hostnamectl | Displays OS and hardware info | Operating System: Red Hat Enterprise Linux 8.7 (Ootpa) |
lsb_release -a | Standard Linux distribution info | Release: 8.7 |
cat /etc/os-release | OS metadata in key-value format | VERSION="8.7 (Ootpa)" |
rpm -q redhat-release | Shows installed release package | redhat-release-8.7-1.el8.x86_64 |
uname -r | Kernel version | 4.18.0-425.el8.x86_64 |
cat /proc/version | Kernel build info | Linux version 4.18.0-425.el8.x86_64 |
Tips for Checking RHEL Version Remotely
If you manage servers remotely, you can check the RHEL version via SSH. Just connect to your server and run any of the commands above.
For example:
ssh user@yourserver
cat /etc/redhat-release
This will quickly tell you the version without needing physical access.
Additional Tips
- Use
sudoif permission is denied. - Combine commands in scripts for automation.
- Keep your system updated for accurate version info.
Conclusion
Now you know several reliable ways to check your Linux RHEL version. Whether you prefer reading system files like /etc/redhat-release or using commands like hostnamectl and lsb_release, these methods are straightforward and effective.
Knowing your RHEL version helps you manage your system better, keep software compatible, and stay secure. Next time you need to verify your system version, just pick the method that suits you best and get the info quickly.
FAQs
How do I check the RHEL version from the command line?
You can run cat /etc/redhat-release or hostnamectl to see your RHEL version quickly from the terminal.
What command shows detailed OS information on RHEL?
The hostnamectl command displays detailed OS and hardware info, including the RHEL version.
Is lsb_release installed by default on RHEL?
No, you may need to install it using sudo yum install redhat-lsb-core before using lsb_release -a.
Can I check the kernel version separately?
Yes, use uname -r to see the kernel version running on your RHEL system.
What file contains OS metadata in key-value pairs?
The /etc/os-release file contains detailed OS metadata in a standardized key-value format.
