
Before installing software, applying a fix or planning a migration, you need to know exactly which version of CentOS (or CentOS Stream, Rocky Linux or AlmaLinux) a server runs. This guide shows the quickest commands to check the version, how to read the output, how to see the kernel version and architecture, and how to tell CentOS Linux apart from CentOS Stream and its successors.
Quick answer
cat /etc/redhat-release
cat /etc/os-release
The first prints a single line such as CentOS Linux release 7.9.2009 (Core). The second shows the name, version and ID in a standard format used by every modern Linux distribution.
Method 1: /etc/redhat-release (or /etc/centos-release)
cat /etc/redhat-release
cat /etc/centos-release
Example outputs:
CentOS Linux release 7.9.2009 (Core)
CentOS Stream release 9
Rocky Linux release 10.1 (Red Quartz)
AlmaLinux release 9.6 (Sage Margay)
For CentOS Linux 7, 7.9.2009 means major version 7, minor version 9, built from the September 2020 (2009) upstream release. CentOS Stream shows only the major version because it is continuously updated.
Method 2: /etc/os-release
cat /etc/os-release
This file exists on all systemd-based distributions and is the most script-friendly option. Key fields:
NAMEandVERSION: human-readable name and version.ID: for examplecentos,rocky,almalinuxorrhel.VERSION_ID: the version number, such as7or9.6.
To print just the version in a script:
. /etc/os-release && echo "$ID $VERSION_ID"
Method 3: hostnamectl
hostnamectl
Along with the host name, it shows Operating System, Kernel and Architecture, and whether the machine is a virtual machine (and which hypervisor) on recent versions.
Method 4: rpm
rpm -q centos-release
rpm -qa | grep -E 'release$'
The first works on CentOS Linux; the second finds the release package on any RPM-based distribution, such as centos-stream-release, rocky-release or almalinux-release.
Method 5: lsb_release
lsb_release -a
This prints the distributor, description, release and codename. It is not installed by default on CentOS; install it with sudo yum install redhat-lsb-core on CentOS 7. On newer releases, use /etc/os-release instead.
Check the kernel version and architecture
uname -r # kernel version, e.g. 3.10.0-1160.el7.x86_64
uname -m # architecture, e.g. x86_64 or aarch64
uname -a # everything
The kernel version tells you the release family too: el7 is CentOS 7, el8 is version 8, el9 is version 9, and el10 is version 10.
CentOS Linux vs CentOS Stream: what your version means
- CentOS Linux 7: end of life since 30 June 2024; no more security updates.
- CentOS Linux 8: end of life since 31 December 2021.
- CentOS Stream 9 and 10: supported, continuously updated previews of upcoming RHEL releases.
- Rocky Linux and AlmaLinux: free, RHEL-compatible replacements for CentOS Linux, each supported for 10 years per major version.
If your server reports CentOS Linux 7 or 8, plan a move to Rocky Linux, AlmaLinux or another supported system. Within version 8, the migrate2rocky or almalinux-deploy tools can convert in place; from version 7, build a new server and migrate your data.
Frequently asked questions
What is the command to check the CentOS version?
cat /etc/redhat-release for a one-line answer, or cat /etc/os-release for full details.
How do I check whether CentOS is 32-bit or 64-bit?
Run uname -m. x86_64 means 64-bit; i686 or i386 means 32-bit.
How do I find the CentOS version in a script?
Source /etc/os-release and read $VERSION_ID, or use rpm -E %rhel, which prints the major version number on RHEL-family systems.
Is CentOS 7 still supported?
No. CentOS 7 reached end of life on 30 June 2024.


