Linux: RedHat / CentOS Command to Check Version

To check for the version that CentOS and RedHat Enterprise Linux (“RHEL”) there are a couple of commands that are useful and will provide the desired results.

cat /etc/redhat-release

CentOS release 5.7 (Final)

cat /etc/issue | grep release

CentOS release 5.7 (Final)

lsb_release -r

Release: CentOS release 5.7 (Final)

If lsb_release is not available then use yum install to install it. yum install redhat-lsb

cat /etc/issue

CentOS release 5.7 (Final)
Kernel \r on an \m