The following table contains the most common and recommended ways on how to check the CentOS version on your CentOS Linux server or desktop.
Command | Description |
---|---|
$ rpm -q centos-release | CentOS version valid for CentOS 6 and higher. Causes to reveal major, minor, and asynchronous CentOS version. |
$ lsb_release -d | Requires redhat-lsb package to be installed before execution. |
$ rpm -E %{rhel} | RPM macro to reveal a major CentOS version |
$ rpm --eval %{centos_ver} | RPM macro to display a major version of CentOS |
$ cat /etc/centos-release | Linux cat command to output content of the /etc/centos-release to query CentOS version. Works with CentOS 6 and higher. |