Determine Redhat Linux Version
Categories:
How to Determine Your Red Hat Enterprise Linux (RHEL) Version

Learn various methods to accurately identify the version of Red Hat Enterprise Linux (RHEL) running on your system, from simple command-line tools to detailed system files.
Knowing your Red Hat Enterprise Linux (RHEL) version is crucial for system administration, software compatibility, security patching, and troubleshooting. Different RHEL versions come with distinct kernel versions, package repositories, and support lifecycles. This article will guide you through several reliable methods to determine your RHEL version, ensuring you always have the correct information at hand.
Method 1: Using the cat /etc/redhat-release Command
The simplest and most common way to check your RHEL version is by examining the /etc/redhat-release file. This file typically contains a single line detailing the distribution name and version number. This method is quick and effective for a direct answer.
cat /etc/redhat-release
Output of the cat /etc/redhat-release command.
Method 2: Using the hostnamectl Command
The hostnamectl command is part of systemd and provides a wealth of information about your system, including the operating system name and version. This command offers a more structured output and can be useful for scripting or automated checks.
hostnamectl | grep "Operating System"
Filtering hostnamectl output for operating system details.
flowchart TD
A[Start] --> B{"Need RHEL Version?"}
B -->|Yes| C[Check /etc/redhat-release]
C --> D{Output Available?}
D -->|Yes| E[Display Version]
D -->|No| F[Try hostnamectl]
F --> G{Output Available?}
G -->|Yes| E
G -->|No| H[Try os-release]
H --> I{Output Available?}
I -->|Yes| E
I -->|No| J[Consult Documentation]
E --> K[End]
J --> KDecision flow for determining RHEL version.
Method 3: Examining /etc/os-release or /etc/system-release
For more detailed and standardized information, especially on newer RHEL versions and other Linux distributions, the /etc/os-release file is a good source. It provides key-value pairs that are easily parseable. The /etc/system-release file is another common alternative that often contains similar information to /etc/redhat-release.
cat /etc/os-release
# OR
cat /etc/system-release
Checking /etc/os-release or /etc/system-release for version details.
/etc/os-release file is part of the systemd specification and is widely adopted across many Linux distributions, making it a more universal approach.Method 4: Using rpm for Package Information
The rpm package manager can also provide insights into your system's version by querying installed packages. Specifically, the redhat-release package (or similar) holds the version information. This method is particularly useful if the standard files are missing or corrupted, though less common.
rpm -q redhat-release
# OR for more verbose output
rpm -qi redhat-release
Querying the redhat-release package using rpm.
sudo privileges if you encounter permission issues with some commands, although most version checks do not require elevated permissions.1. Open a Terminal
Access your RHEL system via SSH or directly open a terminal window.
2. Execute cat /etc/redhat-release
Type cat /etc/redhat-release and press Enter. This is usually the quickest way.
3. Alternatively, use hostnamectl
If the first command doesn't provide enough detail or you prefer a structured output, run hostnamectl | grep "Operating System".
4. For detailed info, check /etc/os-release
Execute cat /etc/os-release to see a comprehensive list of OS details, including version.
5. Verify with rpm (if needed)
As a last resort or for verification, use rpm -q redhat-release to query the installed release package.