Also, knowing the version becomes more vital if you install any software from the repositories or package for better working of the system. It will make sure that you install the packages compatible with your installed version of CentOS.
In this article, we will focus on various ways that will help determine the version of the installed CentOS operating system.
Various methods for checking the CentOS version
There are many ways available to help you find the appropriate version of the installed CentOS on the system. We have mentioned the most commonly used methods for determining the version of the CentOS running on your system. Below are the methods-
- Using the /etc/centos-release file
- Using the lsb_release command
- Using the hostnamectl command
We will go through each method one by one and explain how they are efficient in determining the CentOS version running on your system.
1. Check CentOS Version Using /etc/centos-release File
CentOS operating system comes with a file “/etc/centos-release” that will hold all necessary information regarding the installed operating system. If you are a technical person knowing well about the terminal commands, you can run the “cat” command on this file to get the contents.
It is one of the easiest ways for determining the installed CentOS version.
$ cat /etc/centos-release
In the above image, you can see the details of the installed CentOS operating system. Here, the version is 8.3.2011, which determines the other important information.
- The first part of the version specifies the principal branch of CentOS.
- The second part will specify the latest minor release.
- The last part, which is “2011,” is divided into two other sub-parts: where the “20” will specify the year when the CentOS operating system was released that is (2020), and the other sub-part, which is “11”, will set the month, which is November (11).
2. Check CentOS Version Using lsb_release Command.
One of the other commonly used CentOS commands for determining the installed version of the CentOS operating system is the “lsb_release” command that will provide you with the required information about the version of CentOS installed on your system.
You need to execute the following command on the CentOS terminal.
$ lsb_release -a
For executing the above command, you must have the “redhat-lsb-core” package on your system. If your system does not have this package installed, you will be asked to install the “redhat-lsb-core” package. It would be best if you typed “y” to proceed with installing the package.
If you want to allow the installation of the additional package, then you need to type “y” and hit enter to proceed with the installation.
Once all the packages are installed, the “lsb_release” will start working and display the required information about the installed version of CentOS on the screen. You can see the version number under the description field, as shown in the above image.
3. Check CentOS Version Using hostnamectl Command.
There is another simple way for getting the version number of the CentOS operating system. You can run the “hostnamectl” command for getting the desired information about the installed CentOS version on your system.
The hostnamectl command will not provide you detailed information but only specify the version-relevant information that is the “Operating System: CentOS Linux 8.”
Well, checking the installed version of CentOS on your system is a straightforward task. If you belong to a technical field, you must be aware of three simple steps for determining the CentOS version.
You can use various command-line commands to check the version number. It is useful when installing any software and checking if the installing software is compatible with the underlying OS version. Also, it will help you in troubleshooting purposes. So make sure you have the correct detail.