[How To] Get Centos Version

In this article, we will see how to get CentOS version, see the level of updates, and also find out the kernel version that is currently in use. The instruction is written for CentOS 7, however, it is suitable for earlier versions of the distribution, since the files containing basic information are the same in many versions.

How to see the version of CentOS 7

The basic information about the distribution and its version is stored in following four files:

  • /etc/centos-release
  • /etc/os-release
  • /etc/redhat-release
  • /etc/system-release
$ cat /etc/centos-release
$ cat /etc/redhat-release
$ cat /etc/system-release
$ cat /etc/os-release

All of these four files belong to the centos-release package. Therefore, you can find out the distribution version by looking at the version of this package:

$ rpm -qf /etc/redhat-release

The CentOS version and kernel version can be viewed using the hostnamectl utility:

$ hostnamectl

Another way to see the CentOS version is with the lsb_release utility. It is in the redhat-lsb package and is not installed by default. To install it, do:

yum install redhat-lsb

Then you can run the command:

lsb_release -d

To get full details, use the -a option:

lsb_release -a

How to see the kernel version in CentOS 7

Like other distributions, in CentOS too, we can use the uname utility to view kernel information. To view all available information, use the -a option:

uname -a

To view only the kernel version, specify the -r option:

uname -r

To get the date and time of compilation of the kernel, do:

uname -v



Leave a Reply

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