How To Check CentOS Version {4 Easy Ways} | PhoenixNAP KB
Maybe your like
Knowing the operating system version on your machine can be helpful when troubleshooting system issues. It also helps ensure the system is up to date, preventing potential security risks and vulnerabilities.
This tutorial will show you how to perform version checks on CentOS and Rocky Linux.

Prerequisites
- System running CentOS or Rocky Linux.
- Command-line access.
- A user with sudo privileges.
How to Check CentOS or Rocky Linux Version from Command Line
Users can obtain version information on CentOS and Rocky Linux straight from the terminal. The following sections explain how to use hostnamectl, rpm, and lsb_release commands to determine which version of the operating system is running on the computer.
Find CentOS or Rocky Linux Version with hostnamectl Command
The hostnamectl command queries the system hostname and performs hostname configuration. In addition to the version number, it shows which Linux kernel the system uses.
See the version information by executing the hostnamectl command without any arguments:
hostnamectl
Find CentOS or Rocky Linux Version with RPM
RPM is a free, open-source package manager created for Red Hat Linux and related Linux distributions. Use the following rpm commands to find out the full package name and the release version of CentOS or Rocky Linux:
- On CentOS, enter the following:

- On Rocky Linux, type:

lsb Command to Display Details of CentOS Linux Release
LSB (Linux Standard Base) is a joint project of several Linux distributions to standardize software system structure. One of the commands available from the command line is lsb_release. Its output indicates which OS version is running on the computer.
Proceed with the steps below to install and use lsb_release:
1. Install the command with YUM:
sudo yum install redhat-lsb-coreType y and press Enter to confirm the installation.
Note: The redhat-lsb-core package is unavailable on Rocky Linux, so the lsb_release command can only be used to check the CentOS version.
2. View CentOS version information with the following command:
lsb_release -dThe output displays basic system information, including the OS version.

Check CentOS and Rocky Linux Version in Release File
To check which Linux distro and major release version is installed on the machine, print the contents of the release file using the cat command:
cat /etc/os-releaseThe output shows the operating system name, version number, and other details.

Alternatively, use the cat command to read the /etc/centos-release file for CentOS and /etc/rocky-release for Rocky Linux.
Check Linux Kernel Version on CentOS and Rocky Linux
Knowing the kernel version helps ensure hardware and software compatibility. Find out which Linux kernel version runs on the system with the uname command:
uname –rThe output shows the operating system kernel version. In the example displayed below, the system uses kernel 5.14.0-427.

Conclusion
After reading this tutorial, you will be able to check the version of CentOS or Rocky Linux installed on your computer. The article also showed how to check the Linux kernel version.
To check the version of other Linux operating systems based on Red Hat, read how to check Linux Red Hat (RHEL) version.
Was this article helpful?YesNoTag » How To Check Centos Version
-
How To Check CentOS Version
-
How To Check Your CentOS Version - Linuxize
-
How To Check CentOS Version - The Geek Diary
-
4 Ways To Check CentOS Or RHEL Version - Tecmint
-
How To Check The CentOS Version - Linux Hint
-
How To Check Version Of CentOS - Linux Hint
-
How To Check CentOS Version? [Latest CentOS Version] - MonoVM
-
How To Check CentOS Version In Linux Command Line
-
How To Check CentOS Version In Linux - E Learning
-
Check CentOS Version Command - E Learning
-
How To Determine CentOS Version? - Unix & Linux Stack Exchange
-
How To Check CentOS Version Number You Are Using - ITsyndicate
-
4 Ways To Check The CentOS Version - FOSS Linux
-
How To: 5 Ways To Check CentOS Version - Unix Tutorial