Ubuntu,  Unix

See Version Information In Linux

There are a number of ways to see information about what version of Linux that you’re running on different

cat /etc/lsb-release

Which returns the distribution information, parsed as follows:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04.5
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu Precise Pangolin (LTS)"

LSB_release can also be run as a command, as follows:

lsb_release -a

Which returns the following:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Precise Pangolin (LTS)
Release: 12.04.5
Codename: precise

lab_release can be used as a command as well:

cat /etc/issue.net

Which returns:

Ubuntu Precise Pangolin
(development branch)

In Debian, you can simply look at the version file:

cat /etc/debian_version

Which returns the following:

wheezy/sid

Or Red Hat Enterprise can also be located with /etc/issue.net:

cat /etc/issue.net

With many variants, including OS X, you can also use uname to determine kernel extensions, etc:

uname -a

The thing I’ve learned about Linux is that there’s always a better way to do things. So feel free to comment on your better way or favorite variant!