4 Ways to Check CentOS or RHEL Version

Do you know the version of CentOS/RHEL release you are running on your server? Why is this even important? There are several reasons to keep this information in mind: to quickly gather information about your system; keep up with bug fixes and security updates, and configure correct software repositories for a specific release, among others.

This is probably an easy task for experienced users, but it’s not usually the case for newbies. In this article, we will show how to check the version of CentOS or RHEL Linux installed on your server.

How to Check Linux Kernel Version in CentOS

Knowing the kernel version is just as important as knowing the distro release version. To check Linux kernel version, you can use the uname command.

$ uname -or
$ uname -a	#print all system information
Check Kernel Version in CentOS

Check Kernel Version in CentOS

From the output of the above command, the CentOS is powered by an old kernel version, to install or upgrade to the latest kernel release, follow the instructions in our article: How to Install or Upgrade to Kernel 4.15 in CentOS 7.

How to Check CentOS or RHEL Release Version

CentOS release version numbers have two parts, a major version such as “6” or “7” and a minor or update version, such as or “6.x” or “7.x”, which correspond to the major version and update set of RHEL receptively, used to build a particular CentOS release.

To elaborate more in this, take for instance CentOS 7.5 is built from the source packages of RHEL 7 update 5 (also known as RHEL version 7.5), which is referred to as a “point release” of RHEL 7.

Let’s take a look at these 4 useful ways to check CentOS or RHEL release version.

1. Using RPM Command

RPM (Red Hat Package Manager) is a popular and core package management utility for Red Hat based systems like (RHEL, CentOS and Fedora), using this rpm command, you will get your CentOS/REHL release version.

$ rpm --query centos-release  [On CentOS]
$ rpm --query redhat-release  [On RHEL]
Check CentOS Version Using RPM Command

Check CentOS Version Using RPM Command

2. Using Hostnamectl Command

hostnamectl command is used to query and set Linux system hostname, and show other system related information, such as operating system release version as shown in the screenshot.

$ hostnamectl
Check CentOS Version Using hostnamectl Command

Check CentOS Version Using hostnamectl Command

3. Using lsb_release Command

lsb_release command displays some LSB (Linux Standard Base) and distribution information. On CentOS/REHL 7, the lsb_release command is provided in the redhat-lsb package which you can install it.

$ sudo yum install redhat-lsb

Once you have installed it, you can check your CentOS/REHL version as shown.

$ lsb_release -d
Show CentOS Version

Show CentOS Version

4. Using Distro Release Files

All the above commands retrieve OS release information from a number of system files. You can view the contents of these files directly, using the cat command.

$ cat /etc/centos-release    [On CentOS]
$ cat /etc/redhat-release    [On RHEL]
$ cat /etc/system-release
$ cat /etc/os-release 		#contains more information
Check CentOS Release Version

Check CentOS Release Version

That’s all for now! If you know any other method that should be covered here, let us know via the comment form below. You can also ask any questions related to the topic.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

3 Responses

  1. nnsense says:

    `/etc/os-release` doesn’t exists on CentOS 6.

  2. Deepak Gurejani says:
    # rpm -q centos-release  [On CentOS]
    # rpm -q redhat-release   [On RHEL]

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.