The lsb_release command provides certain LSB (Linux Standard Base) and
distribution-specific information. The command has flags to display some or all of the information.
[user@centos-server ~]$ lsb_release --help FSG lsb_release v2.0 prints certain LSB (Linux Standard Base) and Distribution information. Usage: lsb_release [OPTION]... With no OPTION specified defaults to -v. Options: -v, --version Display the version of the LSB specification against which the distribution is compliant. -i, --id Display the string id of the distributor. -d, --description Display the single line text description of the distribution. -r, --release Display the release number of the distribution. -c, --codename Display the codename according to the distribution release. -a, --all Display all of the above information. -s, --short Use short output format for information requested by other options (or version if none). -h, --help Display this message.
To install lsb_release on CentOS, simply use the following yum command:
sudo yum install redhat-lsb
Once installation is complete, simply use the command with one of the flags above.
[user@centos-server ~]$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop- 4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1- amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.4.1708 (Core) Release: 7.4.1708 Codename: Core
For installation on Ubuntu, you can similarly use the following command:
sudo apt-get update sudo apt-get install lsb-release
The output of this command will look like the following:
user@ubuntu:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial
This should be all that is needed!