The following table contains the most common and recommended ways on how to check the CentOS version on your CentOS Linux server or desktop.


CommandDescription
$ rpm -q centos-releaseCentOS version valid for CentOS 6 and higher. Causes to reveal major, minor, and asynchronous CentOS version.
$ lsb_release -dRequires 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-releaseLinux cat command to output content of the /etc/centos-release to query CentOS version. Works with CentOS 6 and higher.