Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Check CentOS Version

October 30, 2022
in Blog, Linux
0
ADVERTISEMENT

Table of Contents

The purpose of this post is to show how to check the CentOS version of your Linux system. It’s possible to do this from either command line or GUI. Knowing your CentOS version will give you some insight into how long your system will continue to be supported.

How to view CentOS version via GUI

There are several ways on how to check what version of CentOS is running on your system. The simplest way to check for the CentOS version number is to execute the cat /etc/centos-release command. Identifying the accurate CentOS version may be required to help you or your support team to troubleshoot your CentOS system.

Bg2235

How to check CentOS version via command line

The following table contains most common and recommended ways on how to check CentOS version on your CentOS Linux server or desktop.

+-----------------------------+---------------------------------------------------------------+
| Option                      |                          Description                          |
+=============================+===============================================================+
| rpm -q centos-linux-release | CentOS version valid for CentOS 6 and higher.                 |
+-----------------------------+---------------------------------------------------------------+
| rpm -q centos-release       | CentOS version valid for CentOS 6 and higher.                 |
+-----------------------------+---------------------------------------------------------------+
| lsb_release -d              | Requires redhat-lsb package to be installed before execution. |
+-----------------------------+---------------------------------------------------------------+
| rpm -E %{rhel}              | RPM macro to reveal a major CentOS version                    |
+-----------------------------+---------------------------------------------------------------+
| rpm –eval %{centos_ver}     | RPM macro to display a major version of CentOS                |
+-----------------------------+---------------------------------------------------------------+
| cat /etc/centos-release     | Works with CentOS 6 and higher.                               |
+-----------------------------+---------------------------------------------------------------+
| cat /etc/os-release         | Works with CentOS 7 and higher.                               |
+-----------------------------+---------------------------------------------------------------+
# rpm -E %{rhel}
8

# rpm –eval %{centos_ver}
RPM version 4.14.3
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

# cat /etc/centos-release
CentOS Stream release 8

# cat /etc/os-release
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

Alternative commands to check CentOS version

Although available only for CentOS version 7 and above the hostnamectl command might provide you with a significant clue about your OS version number:

# hostnamectl
   Static hostname: ct7
         Icon name: computer-vm
           Chassis: vm
        Machine ID: dc2888319a594372b33b1942e30f938a
           Boot ID: c394954417e146c4ac8f4b3f5b4186c9
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.76.1.el7.x86_64
      Architecture: x86-64

Check CentOS version using a bash script

Create a bash script using the following lines:

#/bin/bash

full=`cat /etc/centos-release | tr -dc '0-9.'`
major=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1)
minor=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f2)
asynchronous=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f3)

echo CentOS Version: $full
echo Major Relase: $major
echo Minor Relase: $minor
echo Asynchronous Relase: $asynchronous

Execute the script to check the CentOS version.

# vi version_check.sh
# chmod +x version_check.sh
# ./version_check.sh
CentOS Version: 7.9.2009
Major Relase: 7
Minor Relase: 9
Asynchronous Relase: 2009
ADVERTISEMENT
5/5 - (1 vote)
Previous Post

YumRepo Error All mirror URLs are not using ftp http[s] or File

Next Post

How to Download the Latest Release from GitHub Repo in Linux

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory