Below are the few commands to get information about the OS Version which you are using in Linux.
1. The File /etc/os-release :
Linux maintains OS information in /etc/os-release file. You can display the file on screen using following command.
# cat /etc/os-release
2. The Command – lsb_release :
The lsb_release command also provides OS information. For this command you need to install following package first and then run the command as given below.
# yum install redhat-lsb-core -y # lsb_release -a
3. The Command – hostnamectl :
The hostnamectl command also provides OS information as given below.
# hostnamectl
Note – All above commands are tested on CentOS 7. Other Linux flavors may provides similar commands with little modification.