Thursday, May 29, 2008

Find your Linux version and other useful information from the command line.

Okay, so I admit it. I am not a Linux guru. I know my way around Linux fairly well, but every now and again I am faced with a problem that just leaves me scratching my head. The other day I needed to find out what distribution of Linux I was using and what version it was. I was left scratching my head, until I did some searching and found a couple of really cool tools.

The first one is:

lsb_release -a

It will give you a nicely little formatted output that looks something like this:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 7.04
Release: 7.04
Codename: feisty


If you need information informatiopn specific to you Linux kernel you can use the uname command.

For example uname-a will give you a great deal of information about the machine you are currently working on. Unfortunately, the output is not as nicely formated as the above command. Your output might look something like this:

Linux don 2.6.22-14-generic #1 SMPSun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux

In my case several of the items normally displayed by uname are omitted because they are unknown.

Now, I don't know about uname, but I have tested lsb_release on Ubuntu, Fedora, SUSE, and Red Hat. I also tested it on Gentoo and know that at least on my installation it did not come as standard.

Have a great day.

No comments: