You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

How do I determine the release version of a CentOS / RHEL / Fedora server without access to the graphical interface?. Knowing the exact release version of your RHEL/CentOS/Fedora Linux system is important when gathering facts for use in deployments automation, system patching, repository configuration, manual software installation and decision making in bash scripting.

check os details

This short guide will discuss the various ways of checking what version of CentOS/Fedora/RHEL server you’re running. One method should be sufficient for your use needs.

Check CentOS / Fedora / RHEL release version

Let’s consider a number of ways you can check version of your CentOS / Fedora / RHEL operating system.

From /etc/redhat-release file

Cat the contents of /etc/redhat-release to get release version. This gives you minimal information on Distribution type, major release, minor release and date code of the minor versions.

# CentOS
$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
$ cat /etc/redhat-release
CentOS release 6.10 (Final)

# Fedora
$ cat /etc/redhat-release
Fedora release 29 (Twenty Nine)

$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.0 Beta (Ootpa)

From /etc/system-release file

This file contains same information as retrieved from /etc/redhat-release file.

$ cat /etc/system-release

Check using lsb_release command

The lsb_release command prints certain LSB (Linux Standard Base) and Distribution information. Install it on your system using the commands below.

# Install lsb_release on CentOS / RHEL
$ sudo yum -y install redhat-lsb-core

# Install lsb_release on Fedora
$ sudo dnf -y install redhat-lsb-core

Check lsb_release command options.

$ lsb_release --help
FSG lsb_release v2.0 prints certain LSB (Linux Standard Base) and
Distribution information.
Usage: lsb_release [OPTION]…
With no OPTION specified defaults to -v.
-v, --version
Display the version of the LSB specification against which the distribution is compliant.
-i, --id
Display the string id of the distributor.
-d, --description
Display the single line text description of the distribution.
-r, --release
Display the release number of the distribution.
-c, --codename
Display the codename according to the distribution release.
-a, --all
Display all of the above information.
-s, --short
Use short output format for information requested by other options (or version if none).
-h, --help
Display this message.


$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 29 (Twenty Nine)
Release: 29
Codename: TwentyNine

$ lsb_release -d
Description: Fedora release 29 (Twenty Nine)

$ lsb_release -r
Release: 29

$ lsb_release -c
Codename: TwentyNine

$ lsb_release -i
Distributor ID: Fedora

$ lsb_release -s

Using hostnamectl command – Systemd server

If you’re on a server with systemd init system, you can get server details with hostnamectl command.

$ hostnamectl 
Static hostname: rhel8.localhost
Icon name: computer-vm
Chassis: vm
Machine ID: d4ff63f9f4454286b1858eb9341eaf4b
Boot ID: 17f7964e5b164204805d0eff0a5bdb16
Virtualization: kvm
Operating System: Red Hat Enterprise Linux 8.0 Beta (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8.0:beta
Kernel: Linux 4.18.0-32.el8.x86_64
Architecture: x86-64

$ hostnamectl
Static hostname: fed29
Icon name: computer-vm
Chassis: vm
Machine ID: a28e93c520b84a50ad3f46093bee11f1
Boot ID: f65448d6f92f485aa5f6e332c280c6e7
Virtualization: kvm
Operating System: Fedora 29 (Cloud Edition)
CPE OS Name: cpe:/o:fedoraproject:fedora:29
Kernel: Linux 4.18.16-300.fc29.x86_64
Architecture: x86-64

Using RPM Command

RPM command can also be used to query OS specific information. The package name varies from one distro to the other.

# CentOS
$ rpm --query centos-release

# Fedora
$ rpm --query fedora-release

$ rpm --query redhat-release

If you want to check Linux kernel version, use uname command.

$ uname -a
Linux rhel8.localhost 4.18.0-32.el8.x86_64 #1 SMP Sat Oct 27 19:26:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r

Check other options that can be used with the uname command.

$ uname --help

When working on a shell script, you may have to strip off some information from the output to get exact match you desire. Commands such as cut, tr, awk should help.

As an appreciation for the content we put out,
we would be thrilled if you support us!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here