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

This is a discussion on How do I discover the Linux distribution installed on a machine? - Questions ; 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, ...

+ Reply to Thread
Results 1 to 2 of 2

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

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

    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



  2. Re: How do I discover the Linux distribution installed on a machine?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    DC wrote:
    > 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?


    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+4wBycWCKlGo6OReTc pdQ/nGRACeIRPx
    mTq2q8DpHEvJ+dLbSW9M6/Q=
    =MOLf
    -----END PGP SIGNATURE-----

+ Reply to Thread