[lug] What distro am I running?

Kenneth D Weinert kenw at quarter-flash.com
Mon Mar 10 11:03:10 MDT 2008


Try using specific lsb_release options. The default (I'm on
ubuntu/gutsy) does as you say, but if I instead use:

lsb_release -a

The result is:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 7.10
Release:        7.10
Codename:       gutsy

You can use individual arguments to get the bits you want and the use of
-s suppresses the headers.

I don't know if it works the same way on the other distros, but it might
be your platform agnostic way of getting the info.

 
On Mon, 2008-03-10 at 10:51 -0600, Jeffrey Haemer wrote:
> 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 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
-- 
Ken Weinert
http://quarter-flash.com

Please avoid sending me Word or PowerPoint attachments
http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20080310/51abcb8b/attachment.pgp>


More information about the LUG mailing list