Operating System Versions

Traditionally, the Unix command uname -a was used to identify the operating system & version. While this is still useful, it will not give information about the Linux distribution nor patch level.


Linux

Most Linux distributions store their description in a text file

Linux DistributionFilename
RedHat 6, CentOS 6, Oracle Linux 6 or later/etc/system-release
Debian 7 or later, Ubuntu 12 or later & OpenSuSE/etc/os-release
Debian 6 or earlier/etc/debian_version
Ubuntu/etc/lsb-release
OpenSuSE/etc/SuSE-release
Oracle Linux/etc/oracle-release
RedHat, CentOS, Fedora/etc/redhat-release
Mandriva/etc/mandrake-release

Most modern Linux distributions are starting to standardize on using either /etc/system-release or /etc/os-release.

For example, on Oracle Linux 6:-

$ cat /etc/system-release
Oracle Linux Server release 6.10
or Fedora Core:
$ fgrep PRETTY_NAME /etc/os-release
PRETTY_NAME="Fedora 27 (Workstation Edition)"
Whereas older Linux operating systems tend to use their own file, eg CentOS 5
$ cat /etc/redhat-release
CentOS release 5.11 (Final)

Note: Some operating systems, such as Oracle Linux, which are largely binary compatible with the equivalent version of RedHat Linux may provide a /etc/redhat-release that advertises itself as RedHat Linux. Therefore, it is advised to inspect files such as /etc/system-release or /etc/os-release before using /etc/redhat-release to accurately identify the operating system that is being used.


AIX

The version & maintenance level of AIX can be determined by inspecting the /usr/lpp/bos/aix_release.level file.

Eg: AIX5.3 ML 11 :-

$ cat /usr/lpp/bos/aix_release.level
5.3.11.0

Solaris

Solaris stores its description in /etc/release

$ head -1 /etc/release
              Solaris 10 11/06 s10s_u3wos_10 SPARC

Legacy Operating Systems

The uname command is sufficient to identify the operating system & version on older operating systems, though the options differ.

Unixware

$ uname -sv
UnixWare 7.1.1

HP-UX

$ uname -sr
HP-UX B.11.11