In this tutorial, we will show you how to check the CentOS version from the command line. As a system administrator, the first question you should ask yourself after getting a new CentOS server to manage is what version of CentOS am I running? The version of the operating system in use on our server is important as it is critical that we have all the latest updates to ensure that the server is secure. There are a few ways to check your VPS hosting is using what version of CentOS. With commands below you can choose one of them to find out which CentOS version is running on your system.
Check CentOS Version
There are several ways on how to check what version of CentOS is running on your system. Below you can find multiple examples on how to determine CentOS version.
$ cat /etc/redhat-release CentOS release 7 (Final)
You can also use the command “
hostnamectl” to find OS version information in CentOS systems. For example:
$ hostnamectl Static hostname: kvm.idroot.us Pretty hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: 3974b10a7fa4421690c2e672917e00b0 Boot ID: 04fb94c0eff94c4ba5a543e085e09ccd Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-325.22.2.el7.x86_64 Architecture: x86-64
Another file that contains the centos version information is
$ cat /etc/issue CentOS release 7 (Final) Kernel \r on an \m
The rpm command can also be used to query for the centos version information:
$ rpm -q centos-release centos-release-7.el7.centos.10.x86_64
Another alternative is to use the
The lsb_release command is not available on centos by default. It can be installed by installing the RedHat LSB packages from the base repository:
yum install redhat-lsb -y
$ lsb_release -d Description: CentOS Linux release 7.1.1503 (Core)