What version of Linux is my machine running ?

| 0 Comments | 0 TrackBacks

Today I needed to report a bug on a piece of software that ran on a linux system. The bug report form asked for a version of the system I was running. On traditional unix system (By these I mean Solaris, HP-UX, Aix), I would run uname -a and the third or fourth argument would be the os name and version. Done I could report my OS version number. I could always run a few other command that would be specific to learn a bit more about the version - but uname -a would give me the information straight away.
so on my Ubuntu system it gave me :

ludo@toto:~$ uname -a
Linux toto 2.6.22-14-server #1 SMP Tue Dec 18 05:52:24 UTC 2007 x86_64 GNU/Linux

Which did not help a lot. After poking a bit I found the following, each distribution as a file in /etc which gives this information :

etc/redhat-release
etc/SuSE-release
etc/gentoo-release
etc/yellowdog-release
etc/mandrake-release
etc/whitebox-release
etc/debian_version

As Ubuntu is a debian derivative it uses the etc/debian_version file - but this might not be enough, the real nice command to run is lsb_release. On OpenSuse this gives :

toto0:~ # lsb_release -a
LSB Version: core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64:desktop-3.1-amd64:desktop-3.1-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.1-amd64:graphics-3.1-noarch
Distributor ID: SUSE LINUX
Description: openSUSE 10.3 (X86-64)
Release: 10.3
Codename: n/a

and on Ubuntu it gives :

ludo@toto:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 7.10
Release: 7.10
Codename: gutsy

As one can see the lsb_release command is the command to figure out which version of linux and which distribution your system is running.
To be complete on AIX the command that gives you more information is oslevel. On Mac OS X it's sw_vers. I currently can't recall what it is for sun, nor for HP-UX.

No TrackBacks

TrackBack URL: http://perso.hirlimann.net/cgi-bin/mt/mt-tb.cgi/1751

Leave a comment

Recent Entries

Jaikoz is unable to retrieve PUID
I use Jaikoz to tags my mp3 and make sure I have a clean music collection. In the last two…
links for 2009-05-19
Arctic Umiaq Line A/S (tags: greenland boat)…
Thunderbird Beta 3 and Beta 4
For those who are wondering why Thunderbird 3.0 b3 is not out yet the explanation is available at http://weblogs.mozillazine.org/dmose/archives/2009/05/thunderbird_3_beta_4_added_1.html…