[lug] What distro am I running?

Jeffrey Haemer jeffrey.haemer at gmail.com
Mon Mar 10 10:51:15 MDT 2008


My Ubuntu boxes have a file called /etc/lsb-release that looks like this:

DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=7.10
> DISTRIB_CODENAME=gutsy
> DISTRIB_DESCRIPTION="Ubuntu 7.10"
>

Nice.

My Fedora 8 boxes have no such file, but have a directory, /etc/lsb-
release.d, with a bunch of 0-length files.
The SuSE 10.1 boxes have both.  Their /etc/lsb-release.d is full of empty
files, and their /etc/lsb-release looks like this:

LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32"
>

All three have a command called lsb_release(1).  Here's what the command
spits out:

F8
    LSB Version:    :
core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
SuSE
    LSB Version:
core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32:graphics-2.0-ia32:graphics-2.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Ubuntu
    No LSB modules are available.

Fedora 8 sticks release info into /etc/redhat-release.  Other RH distros
have this, too, even if I have to do a minor amount of parsing on the
contents.

Fedora Core release 6 (Zod)
Fedora release 8 (Werewolf)
Red Hat Enterprise Server release 5.1 (Tikanga)

SuSE sticks version stuff into a multi-line /etc/SuSE-release, analogous to
Ubuntu's /etc/lsb-release, but with a different syntax.

> SUSE LINUX 10.1 (i586)
> VERSION = 10.1
>
So, is there an /etc/ubuntu-release?  Of course not.  But there is an
/etc/debian_version, which says

> lenny/sid
>

I can hand-craft and maintain a special-purpose script to puzzle it out, but
I thought I'd ask whether there's a simple, standard command, analogous to
uname, to tell me what the heck distro I'm running.  I'd like to be able to
invoke it within scripts that do other, distro-specific stuff.

-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell]
http://goyishekop.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20080310/8b9c5657/attachment.html>


More information about the LUG mailing list