The developers of the operating system CentOS at this point in time maintained three branches of the platforms 5, 6 and 7. Each of these branches has its own version, which is available for download on the official website. Sometimes the user needs to know what build he uses now. If you own to remember such information could not come to the aid of the built-in and additional utilities OS, and all actions are performed through the management console.
Determine the version of CentOS
In the version of CentOS you specify multiple numbers, each of which has its own meaning, for example, 7.6.1810. Here 7 is the major version, 6 is minor, and 1810 — date code minor version. Thanks to these values, the user can easily find out the necessary information and apply them in the field. There are quite a number of commands for the build definition, we advise you to pay attention only to some of them. In today’s article we will talk about these useful tools.
Method 1: Command lsb_release
Standardization of the internal system CentOS is due to the standard Linux Standard Base (LSB). The command lsb_releaseto find out information on the standard basis, is supported by all versions of the considered OS and can be used to display the current build platform. To do this:
lsb_release -aand then press Enter.
sudo yum install redhat-lsb-core.
lsb_release -a, and then see several lines of information, among which will be “Release”.
If for any reason this command is not suitable to or in connection with its absence in the system fails to download the required components from the web, it is advised to use with other options display the version of CentOS with the help of built-in commands.
Method 2: Tool RPM
Experienced users probably know that the RPM (Red Hat Package Manager) is a package management tool in Linux distributions based on Red Hat engine. Such platforms also applies to CentOS. The fact that utilities rpm , there is one special argument, which allows to display a new row with the data about the current version of the system. This requires to start the console and insert the string
--query rpm centos-release.
After activation of the command displays a new row with the desired information. Here will display not only the Assembly version, but its architecture, for example, centos-release-7-6.1810.2.el7.centos.x86_64.
Method 3: cat Command
Standard on all distros based on the Linux kernel, the command cat is used to view the contents of any file type, including configuration. On our site there is an article dedicated to the detailed analysis of the action of this utility, a link to which you will find below.
Today we want to focus only on viewing the two files, and to familiarize themselves with the first, you should write
Activating the command in the next line you will get the desired data.
However, not all users like that in checked the above file contains so little information. Sometimes it may require the definition of an identifier or link to the official website version. In this case, we suggest you to view the contents of the file
/etc/os-release using the same command cat.
Method 4: Command hostnamectl
hostnamectl is a standard CentOS command to find out data about a hostname, the virtualization settings, Kernel version and system architecture. In addition, it can be used and, if necessary, determine the current build of the platform. Then in the console you need to type
hostnamectl and press Enter.
Among all the rows, note the “Operating System”: after the colon and will show the version of the OS. As you can see, there is only a branch. Because this method is not suitable for all users, we put it last.
Our article comes to an end. You just have to see with each given method and choose the best option in this situation or that seemed the simplest.