CentOS

How to Check the CentOS Version

For troubleshooting, bug fixes, and many other reasons, you may need to know the version of the operating system. Particularly when it comes to the configuration of software repositories or installation of any software, it is extremely important to get the right version of the software so that the solution is compatible with the operating system version. This article shows you various methods for determining the version of CentOS.

Checking the CentOS Version

There are multiple methods that you can use to determine the CentOS version. This article shows you the three most effective and efficient methods that will work on any version of the CentOS operating system. The methods included in this article for checking the CentOS system version are as follows:

  • Using the /etc/centos-release file
  • Using the lsb_release command
  • Using the hostnamectl command

We will begin with the simplest method using the /etc/centos-release file.

Check CentOS Version Using /etc/centos-release File

This is one of the simplest and easiest methods for getting the version details of the CentOS operating system. The version details are placed inside the /etc/centos-release file. You can get the version details of the CentOS operating system simply by using the cat command:

$ cat /etc/centos-release

Here, we have the output of the command, which shows that the release version number is 8.3.2011. The following shows you more information about the version number.

The version number of the CentOS operating system consists of three major parts.

  • The first part is the “8,” which indicates the major branch of CentOS.
  • The second part is “3,” which indicates the latest minor release.
  • The last part is “2011,” which is further divided into two parts: “20” indicates the year when the CentOS operating system was released (2020) and “11” indicates the month, which is November (11).

Check CentOS Version Using lsb_release Command

You can also use the lsb_release command to get the version details of the CentOS operating system. Simply type the command given below:

$ lsb_release -a

The lsb_release command requires the “redhat-lsb-core” package to execute. If this package is not installed on your CentOS system, then you will be prompted to install the “redhat-lsb-core” package. Type “y” and press “Enter” to allow the installation of the “redhat-lsb-core” package:

Also, allow the installation of additional packages by typing “y” and pressing the “Enter” button:

After the required packages have been successfully installed, the lsb_release command will print the required information. The version information will be written in the “Description” and “Release” entries and subsequent lines.

Check CentOS Version Using hostnamectl Command

To get the branch number of the CentOS operating system, the hostnamectl command can be used as given below. This command will print all the required details for the CentOS operating system:

$ hostnamectl

The hostnamectl command has printed a rather lengthy output, but the version-relevant information is “Operating System: CentOS Linux 8.”

Conclusion

This post provided three useful methods for determining the version of the CentOS operating system. Knowing the version of the CentOS Operating system will ensure that you can install compatible software and troubleshoot any problems with the CentOS operating system.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.