Just parking this here. Most of the servers I maintain run CentOS, and occasionally I need to know which version of CentOS they’re running. For the servers I maintain, all of these works from the command line to return the version, though the RPM command gives the most detailed information.
# rpm --query centos-release
or
# lsb_release -d
or
cat /etc/centos-release