Find Out Linux Version using Linux Standard Base (LSB) files

You probably know that modern Linux distributions have many things in common. Well, one of the reasons for this is LSB – Linux Standard Base. LSB is a joint project by a number of Linux vendors to standardize the OS environment.

From Linux Standard Base article on Wikipedia:

The goal of the LSB is to develop and promote a set of standards that will increase compatibility among Linux distributions and enable software applications to run on any compliant system. In addition, the LSB will help coordinate efforts to recruit software vendors to port and write products for Linux.

One of the immediate benefits of LSB compliancy is ability to confirm the exact information about your Linux release using the lsb_release command. By exact information I mean the release version, vendor name and most interestingly the codename of your current Linux release.

Red Hat Enterprise Linux LSB information

Here’s how a Red Hat Enterprise Linux 4 update 4 description will look:

bash-3.00$ lsb_release -a
LSB Version:    :core-3.0-amd64:core-3.0-ia32:core-3.0-noarch:graphics-3.0-amd64:graphics-3.0-ia32:graphics-3.0-noarch Distributor ID: RedHatEnterpriseWS
Description:    Red Hat Enterprise Linux WS release 4 (Nahant Update 4)
Release:        4
Codename:       NahantUpdate4

And here is RHEL5 LSB information:

bash-3.1$ lsb_release -a
LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseClient
Description:    Red Hat Enterprise Linux Client release 5 (Tikanga)
Release:        5
Codename:       Tikanga

SUSE Linux Enterprise Desktop (SLED10) LSB

For SUSE Linux Enterprise Desktop, LSB release information will look like this:

sled10~> lsb_release -a
LSB Version:    core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64:desktop-3.1-amd64:desktop-3.1-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.1-amd64:graphics-3.1-noarch
Distributor ID: SUSE LINUX
Description:    SUSE Linux Enterprise Desktop 10 (x86_64)
Release:        10
Codename:       n/a

Ubuntu LSB release information

In Ubuntu, I find the lsb_release information to be most informational – it’s concise but tells you everything you need:

ubuntu$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 7.04
Release:        7.04
Codename:       feisty

See also: