How To Check Your CentOS Version - Linuxize

When you log in to a CentOS machine for the first time, before doing any work you might want to check what version of CentOS is running on your system.

In this tutorial, we’ll show several different commands on how to check what version of CentOS is installed on your system.

At the time of writing, CentOS Linux has three major active released branches, CentOS 5, CentOS 6, and CentOS 7.

Check CentOS version from the Command Line #

The lsb_release command displays Linux Standard Base (LSB) information about your Linux distribution.

This is the preferred method and should work no matter what CentOS version you are running.

Open your terminal and type the following command:

Terminallsb_release -a
check centos version with lsb_release

Your CentOS version will be shown on the Description line. As you can see from the output above I am using CentOS Linux release 7.5.1804.

What does the version number 7.5.1804 mean?

  • 7 is the major CentOS branch.
  • 7.5 is the latest minor version of CentOS 7.
  • 1804 is the date code of the minor version, 1804 means April 2018. This number is used to indicate when the release happened.
TipIf you get a message saying bash: lsb_release: command not found..., it means that the package redhat-lsb-core is not installed on your system. You can easily install it with: sudo yum install redhat-lsb-core

Alternative methods to check CentOS version #

Check CentOS version using the rpm command #

rpm (Red Hat Package Manager) is a package management tool for Red Hat based systems such as RHEL, CentOS and Fedora.

You can use the rpm tool to display information about the centos-release package, which includes the CentOS version in its name:

Terminalrpm --query centos-releaseoutputcentos-release-7-5.1804.4.el7.centos.x86_64

Check CentOS version using the /etc/centos-release file #

The centos-release package provides the /etc/centos-release file.

To find your CentOS version enter the following command:

Terminalcat /etc/centos-releaseoutputCentOS Linux release 7.5.1804 (Core)

Check your CentOS version using the /etc/os-release file #

The /etc/os-release file is present on all systems running systemd and contains operating system identification data.

This method will only work if you have CentOS 7:

Terminalcat /etc/os-releaseoutputNAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://www.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="

Check your CentOS version using the hostnamectl command #

hostnamectl is a command that allows you to set the system hostname , but you can also use it to find your CentOS branch.

This method will work only if you have CentOS 7:

Terminalhostnamectloputput Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: 2849f743fbe74706abaa6cb8b2ae5377 Boot ID: 8259a43c6265465884920ac6d762ed5e Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-862.9.1.el7.x86_64 Architecture: x86-64

Conclusion #

In this guide, we have shown you how to find the version of CentOS installed on your system.

For more information on CentOS releases, visit the Wiki CentOS Releases page.

Feel free to leave a comment if you have any questions.

Tags

centos

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

Subscribe

Unsubscribe anytime. We respect your inbox.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page

Tag » How To Check Centos Version