Skip to content

Instantly share code, notes, and snippets.

@coolnumber9
Created January 30, 2019 13:44
Show Gist options
  • Save coolnumber9/1e92a521b9120d9eadf994a6c3a31ab9 to your computer and use it in GitHub Desktop.
Save coolnumber9/1e92a521b9120d9eadf994a6c3a31ab9 to your computer and use it in GitHub Desktop.
Check the CentOS/RHEL OS Update Level
# Source: https://www.thegeekdiary.com/how-to-check-centos-version/
# package centos-release
rpm -ql centos-release | grep release$
cat /etc/redhat-release
cat /etc/centos-release
cat /etc/os-release
cat /etc/system-release
rpm -qf /etc/redhat-release
# Check the Running Kernel version
uname -s -r
uname -a
#Check kernel compile time (uname -v) and compare with known value:
uname -v
# You can also Verify the kernel package using the rpm command. The command would produce an output only if there is any issue with the installed kernel.
rpm -q --verify kernel-3.10.0-693.21.1.el7.x86_64
# Checking CentOS 7 version
hostnamectl
# Checking the LSB version
Another way to check the centOS version is using the “lsb_release” command. The lsb_release command is provided by the package “redhat-lsb”. This package may not be present by default on the system and you may need to install it first.
yum install redhat-lsb
lsb_release -d
lsb_release -r
lsb_release -a
# Check OS version with GRUB configuration files
Using the GRUB configuration file is not a recommended way of checking the OS version, but I would still like to mention this method here for your information. Search for the “menuentry” (For CentOS 7) and “title” (For CentOS 6) in the GRUB configuration file to find the OS version.
# CentOS 7 Example
cat /boot/grub2/grub.cfg | grep -w menuentry
# In case of CentOS 7, you can also get the current kerel version from the file /boot/grub2/grubenv. For example:
grep saved_entry /boot/grub2/grubenv
# CentOS 6 Example
cat /boot/grub/grub.conf | grep title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment