Linux OS: CentOS Version
The latest CentOS version is CentOS7 (version 7.7.1511)
However, here are the others CentOS version under support: CentOS 6 (version 6.6.8) End Of Life (EOL) CentOS; CentOS 5 — version 5.5.11 –> 31st March 2017; CentOS 4 — version 4.4.9 –> 29th February 2012
8 Ways to Check CentOS Version
Before starting to learn about how to check CentOS version, you should know that CentOS version consists of three parts, which are:
- Major Version: Major release version number
- Minor Version: Minor release version number
- Monthstamp: codebase month and year timestamp
1. /etc/centos-release file
Centos Release Version
2. /etc/system-release file
3. /etc/os-release file
This file contains the Linux OS information. So, you can get the major version number from this file.
4. /etc/redhat-release file
5. lsb_release command
This command doesn’t come pre-installed with the CentOS server. However, you can install it using the following command.
Then, check the CentOS version using the following command.
6. rpm query
7. rpm macro
8. hostnamectl command
Next, the hostnamectl command can be used to get the system information. Also, it reveals the Operating System version.
Are you wondering why this command is printing CentOS 7, whereas others are printing CentOS 8?
Well, it’s because the hostnamectl command doesn’t work in Docker containers. This command output is from my own VPS machine. The other commands output is from my local Docker CentOS 8 container.