Introduction

There are many reasons why you should know the CentOS version you are running. For example, if you are troubleshooting a problem, 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 4 different options on how to check CentOS version in Linux.

how to check version of CentOS tutorial header

Prerequisites

  • System running CentOS
  • 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 command tells you the version number of the OS is running.

  1. Before you can use lsb commands, you have to install the package first. With the command: sudo yum install redhat-lsb-core
  2. Type in the sudo password to authorize the installation and then press y and Enter to confirm.
  3. View the CentOS version information with the command: lsb_release -d

Find version with the hostnamectl command

All CentOS versions 7 and above have 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 the version number, it shows which Linux kernel your system is using.

To see these specifics, use the command:

hostnamectl

example output of the version number and output

Find CentOS version with RPM

RPM is a free and open-source package manager created initially for Red Hat Linux. Today all Linux distributions use it.

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 

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.

command output 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

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 in CentOS you running, with the 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.

linux kernel version displayed in CentOS

Conclusion

This article showed you how to check centos version four (4) different ways. Also, you now know how to find the Linux kernel version.

If you discover you are not using the latest stable version, read our guide on how to update CentOS!