The minor version of RHEL server is defined by the /etc/redhat-release file and it belongs to redhat-release-server package. The lsb_release script points to /etc/redhat-release which gives the same output as ‘cat /etc/redhat-release’. Linux Standard Base (LSB) is basically a standard that multiple distributions sign up to. It specifies a Filesystem Hierarchy Standard (FHS), as well as various other components of a Linux system.
You might have noticed the Ubuntu usage of lsb_release to grab its OS version; the same can be done on CentOS, but first, lsb_release needs to be installed:
# yum install redhat-lsb-core
Now, we can run the same command that Ubuntu uses in order to get OS information:
$ lsb_release -s -d "CentOS Linux release 7.5.1804 (Core) "
The same can be done on Debian, without having to install anything by default:
$ lsb_release -s -d Debian GNU/Linux 9.5 (stretch)
lsb_release Command Examples
1. To get the LSB distribution information:
# lsb_release
2. To get all the LSB distribution information:
# lsb_release -a # lsb_release --all
3. To display the string id of the distributor:
# lsb_release -i # lsb_release --id
4. To display the single line text distribution:
# lsb_release -d # lsb_release --description
5. To display the release number of the distribution:
# lsb_release -r # lsb_release --release
6. To Display the codename according to the distribution release:
# lsb_release -c # lsb_release --codename
7. To Use short output format for information requested:
# lsb_release -s # lsb_release --short
8. To get the help:
# lsb_release -h # lsb_release --help