How To Identify Linux Distribution
Sometimes I come across a Linux install and don't know what distribution runs on it. This page documents the markers I found that permit identification of distribution including its version.
RPM based distributions
These can typically be identified by the presence of "rpm" command. Most systems will have rpm or apt installed, but not both.
Fedora, RHEL and Centos distributions along with their versions
can be quickly gleaned from the output of rpm -qa
:
- Fedora installations will have many packages with
.fcXX.
in their name, where XX is a number like 20 signifying Fedora release. - RHEL and Centos installations will have many packages with
.elX
suffix, where X is a number like 5 signifying the major version of the release. - Centos will have packages with
.centos
in their names, whereas RHEL is unlikely to have any such packages.
Debian and derivative distributions
These can typically be identified by the presence of "apt" and "dpkg" commands.
Debian and Debian derivatives have a /etc/debian_version
file.
Stable Debian releases have the release version number in it, like 7.0
.
Systems running the testing distribution will show the
code name of the distribution, like jessie/sid
.
Ubuntu is apparently built from Debian testing, thus it has
the Debian release it was built from, like jessie/sid
, in its
/etc/debian_version
file. Ubuntu can be easily identified by
looking for ubuntu
in package versions obtained from dpkg -l
.
Ubuntu version
can be identified
by running lsb_release -a
, or checking /etc/lsb-release
which has
the same information.
lsb_release -a
works on Debian as well but the corresponding file
is /etc/os-release
.
Another technique that works on Debian and Ubuntu,
per this page,
is checking /etc/issue
.