• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Check CentOS Version With Different Methods

Written by Admin, Updated On May 16, 2019
centos, terminal
Check CentOS Version

It’s a important part to know the version of the system on which you are working. There are different ways to check CentOS version. CentOS release version has three major parts major release version, minor release version, and data code version. This tutorial will show you different methods to get CentOS version.

Check CentOS version from the Command Line#

It is preferred to check version using command line as it is not depend on anything. So here we are going to check CentOS version using lsb_release (Linux Standard Base) utility. Generally, this method is best because it will work regardless of any desktop environment or version you are using.

Open your terminal and type the following command:

lsb_release -a

It will show output as below:

Output
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.6.1810 (Core)
Release: 7.6.1810
Codename: Core

In above output you can see that Description line is showing OS version. Currently, I am using CentOS Linux release 7.6.1810.

Check Version Using RPM Command#

rpm (Red Hat Package Manager) is a package management tool for CentOS, Fedora and Red Hat Enterprise Linux which are based on Red Hat.

You can use below command to get CentOS version using rpm tool:

rpm --query centos-release
Output
centos-release-7-6.1810.2.el7.centos.x86_64

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

You also can get version using centos-release file which is located at /etc/centos-release. It contains package information in CentOS.

cat /etc/centos-release

The output should look like:

Output
CentOS Linux release 7.6.1810 (Core)

Get Version using /etc/os-release file#

You also can check version using os-release file. It contains identification data of operating system and this available only with newer CentOS distribution. This method will work only if you have CentOS 7.

Output
NAME="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://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Check CentOS Version using hostnamectl command#

Generally, hostnamectl command is used to set hostname in CentOS systems but you also can check the system details using it. Execute below command:

hostnamectl
Output
Static hostname: local.tecnstuff
Pretty hostname: TecNStuff's Server
Icon name: computer-vm
Chassis: vm
Machine ID: 44dddc11e56e403d8053ecdf0b92d462
Boot ID: 615f6cb9fc2e4903818a192eddb860bc
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-957.5.1.el7.x86_64
Architecture: x86-64

Conclusion#

In this guide, you have learned how to get CentOS version using different methods.

If you have any query or suggestion then leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Java on Debian 9 System
Next Article   How to List Users in Linux

Related Posts

  • How to Install SSH Keys on Ubuntu 22.04

    How to Set up SSH Keys on Ubuntu 22.04

    January 7, 2023
  • How to Install Fail2ban on Ubuntu 22.04

    How to Install and Configure Fail2ban on Ubuntu 22.04

    December 5, 2022
  • How to Enable SSH on Ubuntu 22.04

    How to Enable SSH on Ubuntu 22.04

    December 1, 2022

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook