CentOS or RedHat Enterprise Linux is popular enterprise level Linux distribution. Different versions of the CentOS and RHEL is use In enterprise environment. Because of its stability and long time support old versions of CentOS and RHEL systems works in production too. In this tutorial w will look different ways to check and find CentOS and RHEL systems.
hostnamectl is very useful command which provides some basic information about the CentOS system like version. We can run command and see the
Operating System: line which is CentOS 7
rpm is a tool used to manage system tools and packages. As packages are compiled according to operating system version and architecture
rpm command has information about the CentOS version and architecture too. We can use
--query centos-release option in order to list CentOS version like below.
$ rpm --query centos-release
lsb_release command is mainly designed to provide the CentOS version and subversion. By default it is not installed but we can install it like below.
$ yum install redhat-lsb
and then we can run like below.
$ lsb_release -d
Release versions of CentOS and RedHat also saved in different files according to the version of the system. Here list of the files those provides the system version.
We can run a single
cat command which will print version information from all of them like below.
$ cat /etc/*release
As we can see we will get a lot of duplicate but consistent version information from this command.