How to check CentOS Version

In this article, we will see how to check CentOS version using different commands.

When we log in to a CentOS machine for the first time, before doing any work we might want to check what version of CentOS is running on your system.

1. Find the CentOS version using command line.

more /etc/os-release

NAME="CentOS Stream" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Stream 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8" REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

2. Let’s look into the /etc/centos-release file

Linux more command to output content of the /etc/centos-release to query CentOS version. Works with CentOS 6 and higher.

cat /etc/centos-release

Output:

CentOS Stream release 8

3. Let’s look into the /etc/redhat-release

cat /etc/redhat-release

Output:

CentOS Stream release 8

4. Use hostnamectl to confirm Linux release

We can use the hostnamectl command to check the Centos Version.

hostnamectl

Output:

Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: 96a9407fafa8438d861c29d5a70bc9d3 Boot ID: baf321e05995422a8bcea7497a398cf1 Virtualization: vmware Operating System: CentOS Stream 8 CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-240.el8.x86_64 Architecture: x86-64

5. Using lsb_release

Linux Standard Base (LSB) is a joint project by major Linux vendors to standardise configuration and usage of Linux distros. Amonth other things, it provides the lsb_release command that can help you check CentOS version.

lsb_release -a

Output:

LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOSStream Description: CentOS Stream release 8 Release: 8 Codename: n/a

So in this article, we have seen different methods to find the CentOS version installed on our machine.