How To: 5 Ways to Check CentOS Version

One of the very first questions a Linux user asks is about confirming the release (OS version) in use. Knowing release helps with highlighting software dependencies and compatibilities, confirms availability of certain features in your OS and simplifies the process of system administration – certain releases have a preferred set of commands for day-to-day management.

With CentOS being a rather popular server grade Linux distro, I can see that many visitors of my blog look for the same guidance quite regularly: check CentOS version. This article introduces 5 of the most common ways to do just that.

1. Inspect /etc/system-release

Just to be super sure that you’re actually looking at a CentOS distribution of Linux, I suggest you start with the /etc/os-release file. As shown below, it will help you with confirming your Linux distro and its major release version (CentOS and 7 in my case):

[email protected]:~ $ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID_LIKE="rhel fedora"
PRETTY_NAME="CentOS Linux 7 (Core)"


Now that we’re sure it’s CentOS, let’s look into the /etc/centos-release file – this will show you the full release version of your operating system:

[email protected]:~ $ cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)

Interesting: if you’re coming from RedHat infrastructure, you’d normally be looking for /etc/redhat-release file. That’s okay and the good news is this will still work in CentOS:

[email protected]:~ $ cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

In fact, if you look at the /etc/redhat-release file on a CentOS server closely, you’ll notice that it is a symbolic link to /etc/centos-release:

[email protected]:~ $ ls -ald /etc/redhat-release
lrwxrwxrwx. 1 root root 14 Sep 18 2017 /etc/redhat-release -> centos-release

2. Use hostnamectl to confirm Linux release

Provided that you’re running a recent enough version of Linux, you should have the hostnamectl command installed.

Among other things, hostnamectl provides easy access to the OS release information and Linux kernel version:

[email protected]:~ $ hostnamectl
Static hostname:
Icon name: computer-desktop
Chassis: desktop
Machine ID: 5f7e36c18a974f06ae94ddaaf11d71e8
Boot ID: 337e48b00fed4abe9ab929fed5aa6018
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.11.6.el7.x86_64
Architecture: x86-64

3. Confirm CentOS version with rpm

Next option you have is to use the RPM package manager to query a special package named centos-release. It will include the exact CentOS release version right in its full package name:

[email protected]:~ $ rpm -qa centos-release

if you’re using RedHat, just do the same for the redhat-release package.

4. Confirm CentOS version using Linux kernel version

There are many ways to confirm your Linux kernel version, like uname command:

[email protected]:~ $ uname -r

Using the kernel version number – 3.10.0-693 in my example – you can confirm the CentOS release using one of the public version information pages, like the CentOS wikipedia page.

Once you browse to the CentOS wikipedia page, just search for the kernel version number and it should find something like this for you, confirming CentOS version to be 7.4-1708:

CentOS version numbers and release dates

5. Use lsb_release command to confirm Lunux release

Linux Standard Base (LSB) is a joint project by major Linux vendors to standardise configuration and usage of Linux distros. Amonth other things, it provides the lsb_release command that can help you check CentOS version.

Most likely, you’ll have to install it first:

[email protected]:~ $ yum install redhat-lsb-core

Once installed, run the lsb_release command with the -d option:

[email protected]:~ $ lsb_release -d
Description: CentOS Linux release 7.4.1708 (Core)

See Also

Keep Learning with Me

Follow me on Facebook and Twitter or jump into Telegram chat!:
I'm using Brave browser
Give it a try, it's awesome: Brave Browser
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!

Recent Tweets