How to Find RHEL Linux Version
Finding the version of your Red Hat Enterprise Linux (RHEL) system is essential for managing software, troubleshooting, and ensuring compatibility. Whether you're a system administrator or a casual user, knowing your RHEL version helps you understand what features and updates are available. In this article, I’ll guide you through several easy ways to check your RHEL version using commands and files.
You don’t need to be a Linux expert to find this information. I’ll explain each method clearly, so you can pick the one that fits your situation best. Let’s dive into how you can quickly identify your RHEL version.
Why Knowing Your RHEL Version Matters
Before we jump into commands, it’s good to understand why you need to know your RHEL version. Red Hat Enterprise Linux is widely used in enterprise environments, and different versions have different support lifecycles, security patches, and software compatibility.
- Software compatibility: Some applications require a minimum RHEL version.
- Security updates: Knowing your version helps you apply the right patches.
- Troubleshooting: Support teams often ask for your RHEL version.
- System upgrades: Planning upgrades depends on your current version.
By checking your RHEL version, you ensure your system runs smoothly and stays secure.
Using the /etc/redhat-release File
One of the simplest ways to find your RHEL version is by checking the contents of the /etc/redhat-release file. This file contains a plain text string that shows the exact version of your Red Hat system.
To check it, open your terminal and type:
cat /etc/redhat-release
You will see output similar to:
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 all RHEL versions and is very reliable.
Why Use /etc/redhat-release?
- It’s a standard file present on all RHEL systems.
- Provides a clear, human-readable version string.
- No special permissions required to read it.
If you want a quick check without extra commands, this is your go-to method.
Checking /etc/os-release for Detailed Info
Another useful file is /etc/os-release. It contains more detailed information about your Linux distribution in a structured format.
Run this command:
cat /etc/os-release
You’ll get output 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"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
This file is great if you want to parse version info programmatically or get more metadata about your system.
Benefits of /etc/os-release
- Provides structured data for scripts.
- Shows version ID and codename clearly.
- Includes URLs for support and bug reporting.
If you’re writing automation scripts, this file is very handy.
Using the hostnamectl Command
The hostnamectl command is primarily used to manage the system hostname, but it also displays OS information including the RHEL version.
Simply type:
hostnamectl
You’ll see output like this:
Static hostname: myserver.example.com
Icon name: computer-server
Chassis: server
Machine ID: abcdef1234567890abcdef1234567890
Boot ID: 1234567890abcdef1234567890abcdef
Operating System: Red Hat Enterprise Linux 8.7 (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8.7:GA
Kernel: Linux 4.18.0-425.el8.x86_64
Architecture: x86-64
Look for the "Operating System" line to find your RHEL version.
Why Use hostnamectl?
- Provides version info along with other system details.
- Useful if you want a quick overview of your system.
- Available on RHEL 7 and later.
This method is user-friendly and gives a nice summary.
Using the lsb_release Command
The lsb_release command is part of the Linux Standard Base and provides distribution-specific information. However, it may not be installed by default on RHEL.
To check your version, run:
lsb_release -a
If installed, you’ll see output like:
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
If the command is missing, you can install it with:
sudo yum install redhat-lsb-core
When to Use lsb_release
- When you want standardized Linux distribution info.
- Useful for scripts that run on multiple Linux distros.
- Provides detailed version and codename info.
Keep in mind this tool is optional and may require installation.
Checking Kernel Version with uname
While the kernel version is not the same as the RHEL version, it can give clues about your system’s age and updates.
Run:
uname -r
Example output:
4.18.0-425.el8.x86_64
The "el8" part indicates this kernel is built for RHEL 8. However, kernel versions can be updated independently, so this is less precise than other methods.
When to Use uname
- To check kernel version for troubleshooting.
- To get a rough idea of your RHEL major version.
- Not recommended as the sole method to find RHEL version.
Use this alongside other commands for a fuller picture.
Using rpm Command to Query redhat-release Package
RHEL installs a package called redhat-release that contains version info. You can query it with rpm:
rpm -q redhat-release
Output might be:
redhat-release-8.7-1.el8.x86_64
This confirms the installed release package version, matching your RHEL version.
Advantages of rpm Query
- Confirms the exact release package installed.
- Useful for verifying system consistency.
- Works well in scripted environments.
This method is more technical but very accurate.
Summary Table of Commands to Find RHEL Version
| Command/File | Description | Output Example |
cat /etc/redhat-release | Simple text file with version info | Red Hat Enterprise Linux Server release 8.7 (Ootpa) |
cat /etc/os-release | Structured OS metadata | VERSION="8.7 (Ootpa)" |
hostnamectl | System info including OS version | Operating System: Red Hat Enterprise Linux 8.7 (Ootpa) |
lsb_release -a | Standard Linux distro info | Release: 8.7 |
uname -r | Kernel version | 4.18.0-425.el8.x86_64 |
rpm -q redhat-release | Query release package version | redhat-release-8.7-1.el8.x86_64 |
Tips for Checking RHEL Version Remotely
If you manage servers remotely, you can run these commands over SSH:
ssh user@server "cat /etc/redhat-release"
Or use automation tools like Ansible to gather version info from multiple hosts.
- Use SSH keys for secure access.
- Combine with scripts to audit many servers.
- Always verify you have permission to access remote systems.
Remote checks help keep your infrastructure up to date.
Troubleshooting Common Issues
Sometimes, you might find the version files missing or commands not working. Here’s what to do:
- File missing: Check if you have the right permissions or if the system is a minimal install.
- Command not found: Install missing packages like
redhat-lsb-core. - Conflicting info: Use multiple methods to cross-check your version.
- No SSH access: Use console or physical access to check version.
These tips help you get accurate info even in tricky situations.
Conclusion
Finding your RHEL Linux version is straightforward once you know where to look. The /etc/redhat-release file is the simplest and most reliable source. For more detailed info, /etc/os-release and commands like hostnamectl or lsb_release provide extra context.
Knowing your RHEL version helps you manage updates, install compatible software, and troubleshoot effectively. Whether you’re working locally or remotely, these methods give you quick access to the information you need. Keep this guide handy, and you’ll always know how to find your RHEL version with confidence.
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 if /etc/redhat-release file is missing?
Try checking /etc/os-release or use rpm -q redhat-release. If commands are missing, install necessary packages like redhat-lsb-core.
Can I find RHEL version remotely?
Yes, use SSH to run commands like ssh user@host "cat /etc/redhat-release" to check the version on remote servers.
Is kernel version the same as RHEL version?
No, the kernel version shows the Linux kernel build, which may differ from the RHEL release version.
What command shows detailed OS info including RHEL version?
The hostnamectl command displays detailed system info, including the RHEL version and codename.
