How to Check CentOS Version?

April 8, 2019

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.

Instructions on how to check your 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
example of centos version number and output

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 
Example of RPM command to view version of CentOS

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.

example of Centos command output for operating system and release version

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
example of major, minor and 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.

example of linux kernel version displayed in CentOS

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!

Was this article helpful?
YesNo
Sofija Simic
Sofija Simic is an experienced Technical Writer. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.
Next you should read
How to Install CentOS 8 {with Screenshots}
December 14, 2019

Since there is no way to upgrade from CentOS 7 to CentOS 8, users need to go through the entire installation...
Read more
How to Upgrade Linux Kernel in CentOS 7
October 8, 2019

The Linux kernel is the underlying software architecture of each Linux distribution. It provides and defines...
Read more
How to Check Your Ubuntu Version
July 7, 2019

Finding out which Ubuntu version is running on your system can be important when troubleshooting issues or...
Read more
How to Set or Change a Hostname in CentOS 7
October 21, 2018

This technical guide is for users who already have a server running the CentOS 7 operating system on a...
Read more