Introduction
CentOS is a popular Linux distribution used by many organizations and individuals. It is important to know the version of CentOS you are running in order to ensure that you are running the most up-to-date version and to ensure compatibility with other software. In this guide, we will show you how to check the version of CentOS you are running.
How to Check CentOS Version?
To check the version of CentOS you are running, open a terminal window and type the following command:
cat /etc/centos-release
This will output the version of CentOS you are running.
Introduction
There are many reasons why you should know the CentOS version you are running. For example, if you are troubleshooting a system issue, you will want to know.
Also, it’s useful to ensure your Linux operating system is up-to-date. Outdated software can cause serious security risks and vulnerabilities.
In this tutorial, discover four different options on how to check CentOS version.
Prerequisites
- System running CentOS
- Access to a terminal window/command line (Ctrl-Alt-F2)
How to Check CentOS Version From Command Line
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 lsb_release
. The output will indicate which OS version you are running.
1. Before you can use lsb
commands, you have to install the package first. Use the following command:
sudo yum install redhat-lsb-core
2. Type in your sudo password to authorize the installation and then press y and Enter to confirm.
3. View CentOS version information with the command:
lsb_release -d
Find CentOS Version with the hostnamectl Command
CentOS version 7 and above has the hostnamectl
command, which can query and change the hostname and other related settings. It displays information from the /etc/centos-release file, uname –a file and others.
In addition to version number, it indicates which Linux kernel your system is using.
To see these specifics, use the command:
hostnamectl
Find CentOS Version with RPM
RPM is a free and open-source package manager created for Red Hat Linux and its related distributions.
With the rpm
command, you can find out the full package name and the release version of CentOS you are running.
Use the command:
rpm –qa centos-release
Check CentOS Version in Release File
To check which Linux distro and major release version you have installed, open the release file using the command:
cat /etc/os-release
The output reveals the name of the operating system, its major release version, and other specifics, as displayed in the image below.
To see the full release version, use the command:
cat /etc/centos-release
The output reveals the full release version of your operating system, including the:
- Major release number
- Minor release number
- Asynchronous release number
Check Linux Kernel Version in CentOS
Knowing the kernel version you are running is often as useful as finding the release version.
Find out which Linux kernel version you running, with the uname command:
uname –r
The output you receive is the version number of the kernel of your operating system.
In the example displayed below, 3.10.0.957.
Conclusion
This article details 4 ways to check CentoOS version installed. Also, you now know how to check the Linux kernel version. To learn how to check the version of other Red Hat based Linux operating systems check our guide on “Check Linux Red Hat (RHEL) Version“.
If you discover you are not using the latest stable version, read our guide on how to update CentOS!