How to Check CentOS Version

Check CentOS Version

You should always know the version of the system you are working on. There are different ways to get the CentOS version. CentOS release version has three major parts major release version, minor release version, and data code version. The easiest way to check centos version is using the file centos-release. In this tutorial, you are going to learn how to check the CentOS version using different methods.

Check Version Using RPM Command

rpm is the package management tool for CentOS, Fedora and Red Hat Enterprise Linux.

You can run the following command to check CentOS version using the rpm command:

rpm --query centos-release

The output should look like


Using lsb_release Command

lsb_release the command displays LSB (Linux Standard Base) information about your Linux system.

Run below command to check CentOS version using the command lsb_release.

lsb_release -a

The output should look like:

Description: CentOS Linux release 7.5.1804

Check CentOS version Using /etc/centos-release File

/etc/centos-release the file contains package information in CentOS.

Run the following command to get CentOS version:

cat /etc/centos-release

The output should look like:

CentOS Linux release 7.5.1804 (Core)

Check CentOS version using os-release File

os-release file contains identification data of the operating system. If you are running CentOS 7 or newer then you can use the following command.

cat /etc/os-release

The output should be similar like below:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID_LIKE="rhel fedora"
PRETTY_NAME="CentOS Linux 7 (Core)"


Check System Info using hostnamectl command

hostnamectl command is used to set the hostname but we can also check OS information using this command.


The output should be similar to this:

Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 2849f743fbe74706abaa6cb8b2ae5377
           Boot ID: 8259a43c6265465884920ac6d762ed5e
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-862.9.1.el7.x86_64
      Architecture: x86-64

Check System Info using Neofetch

Neofetch is a command line utility used to check essential system information. Neofetch shows system information beautifully.

Install Neofetch command line utility using the following command inside your CentOS system:

sudo yum install neofetch

Now after installation completes you can check system information by using the following command:



You have successfully learned how to check CentOS version using different methods. If you have any queries regarding this please don’t forget to comment below.