Linux

How to Check CentOS Version?

Introduction

Just like a car driver, an operating system is the driver and manager of your computer. One such smart driver is CentOS, which is an open-source operating system. What difference does an open-source OS make? Well, the differentiating point is that such an OS is free, while other paid versions include Windows and macOS.

So how is this article going to help you? The main focus of this article is to enlighten our readers about how to check CentOS version. Now, you may think, why is this version inquiry so critical?

How to check CentOS Version?

Windows and macOS are like drivers you pay for, and CentOS is like a skilled, reliable driver who works for free. It’s a trustworthy choice, especially for businesses and organizations, because it gets the job done without any cost.

Also Read: How to List Users and Groups in Linux?

Practical Approach to Check CentOS Version From Command Line

Check CentOS Version From Command Line

It is very easy to check which CentOS version is running on your system through a variety of methods. We have focused on each method in detail for the convenience of our readers. So, let’s get started. 

lsb Command method to check CentOS service status

LSB simplifies software development for Linux systems, making it easier for developers to create programs that can run on multiple systems. This helps avoid the need for extensive changes to be made to the program for each system it will be used on. The below syntax will display information about the current version. The user needs to remember that the below syntax will only work if the system already has redhat-lsb installed. 

lsb_release -a
Check CentOS Version From Command Line

Check the CentOS version with the hostnamectl command

To check the CentOS version using the hostnamectl command, you can use the following command in the terminal:

Hostnamectl
Check CentOS Version From Command Line

This command provides system information such as the OS, kernel, architecture, and CentOS version. Look for “Operating System” or “Operating System: CentOS” to find the CentOS version

Identify the CentOS version with RPM

To identify the CentOS version using RPM (Red Hat Package Manager), you can use the following command in the terminal:

rpm -q centos-release
Check CentOS Version From Command Line

This command queries the installed centos-release package to display the CentOS version on your system.

Use the release file method to check CentOS Version

You can also identify the CentOS version by checking the contents of the release file. The CentOS version information is typically stored in the /etc/centos-release file. To view the contents of this file and determine the CentOS version, use the following command in the terminal:

cat /etc/centos-release

Executing this command will provide you with information about the version of CentOS that is currently installed on your system.

CentOS version check through Linux Kernel

You can indirectly determine the version of CentOS by checking the kernel version, as the CentOS version is often associated with specific kernel versions.

uname -r
CentOS version check through Linux Kernel

Also Read: A Step-By-Step Guide to Install and Use ifconfig on CentOS

Conclusion

Knowing the version of CentOS that is running on your system is essential for proper configuration and system maintenance. Fortunately, there are multiple ways to identify the CentOS version installed on your computer. Here is a summary of the methods covered:

1. Using lsb_release -a: This command provides comprehensive system information, including the CentOS version, if the redhat-lsb package is installed on your system.

2. Executing hostnamectl: This command displays system details, including the CentOS version, under “Operating System” or “Operating System: CentOS”.

3. Utilizing rpm -q centos-release: This command queries the installed package centos-release to display the CentOS version.

4. Examining the contents of /etc/centos-release: This file contains information about the installed CentOS version and can be viewed using the command cat /etc/centos-release.

5. Indirectly inferring CentOS version by checking the kernel version: CentOS versions are associated with specific kernel versions, so you can use the uname -r command to check your kernel version and infer the CentOS version.

Each method has its advantages and disadvantages, and the choice of the method depends on the user’s preference and the availability of certain tools/packages on their system. By using any of these methods, you can easily identify the CentOS version running on your system, which is crucial for proper system maintenance.

Arpit Saini

He is the Chief Technology Officer at Hostbillo Hosting Solution and also follows a passion to break complex tech topics into practical and easy-to-understand articles. He loves to write about Web Hosting, Software, Virtualization, Cloud Computing, and much more.

Related Articles

Leave a Reply

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