Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I discover the Linux distribution installed on a machine?

1 view
Skip to first unread message

DC

unread,
Mar 10, 2005, 1:55:43 PM3/10/05
to
I've got several Linux machines in my office and I need to be able to find
out programmatically / via script which distro is on the box. Uname was my
first guess, but it only reliably delivers the kernal version, some times
the Distro, and sometimes "unknown" (unhelpful). Any ideas?

Thanks

David


Lew Pitcher

unread,
Mar 10, 2005, 3:48:52 PM3/10/05
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There are no *reliable* ways to find out programmatically which
distribution has been installed on a system. There are many *unreliable*
ways to do so, but all involve some amount of guessing or uncertainty.

You can look for the existance of /etc/*release* and /etc/*version*
files; some distributions use these files (various names, like
/etc/slackware-version, etc.) to carry version or release numbers. Most
small distros don't do this, though.

You can also inspect the /etc/motd, /etc/issue, and /etc/issue.net files
as some distros place distribution identifiers in these files. Note that
these files are customizable by the installation, and may no longer
carry their default text, even if they exist and are readable by your
scripts. Note also that the names of these files are somewhat plastic,
as most are assigned by configuration files like /etc/login.defs

Neither of these strategies will give 100% accuracy; you will still get
a number of "unknown" systems, unless your office has refrained from
customizing the systems, and has installed recent 'big name'
distributions instead of older or small name distributions.


- --

Lew Pitcher, IT Specialist, Enterprise Data Systems
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFCMLK0agVFX4UWr64RAmehAKCV+4wBycWCKlGo6OReTcpdQ/nGRACeIRPx
mTq2q8DpHEvJ+dLbSW9M6/Q=
=MOLf
-----END PGP SIGNATURE-----

0 new messages