How to Determine if Your Linux System is CentOS 7.9

1. Check /etc/redhat-release

cat /etc/redhat-release

Output:

CentOS Linux release 7.9.2009 (Core)

2. Check /etc/os-release

cat /etc/os-release

Output:

NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

Note: If it is CentOS 7.9, VERSION_ID=”7″ will show the major version number as 7, while PRETTY_NAME will show CentOS Linux 7 (Core).

3. Use the rpm command to check the version

rpm -q centos-release

If the system is CentOS 7.9, the output will be:

centos-release-7-9.2009.1.el7.centos.x86_64

Note: 7-9 indicates the 9th update of CentOS 7 (i.e., CentOS 7.9)

4. Use the lsb_release command

lsb_release -a

Example output:

LSB Version:    :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description:    CentOS Linux release 7.9.2009 (Core) Release:        7.9.2009 Codename:       Core

5. Check /etc/centos-release

cat /etc/centos-release

If it is CentOS 7.9, the output will be:

CentOS Linux release 7.9.2009 (Core)

Leave a Comment