Monday, 30 June 2008

Finding Out The Linux Distro and Version Info

Lot's of times we end up working on a system/server we don't know any thing about. So to be able to do more meaningful stuff, we need to find out what breed of Horses we are actually gonna race with.

1. The most basic way to do it would be to use "/PROC/" file system.
More specifically, the "version" file.

bash# cat /proc/version
Linux version 2.6.9-42.ELsmp (bhcompile@hs20-bc1-1.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-2)) #1 SMP Wed Jul 12 23:27:17 EDT 2006


2. Use "LSB" as fodder (Linux Standard Base)

bash# lsb_release -a
LSB Version: :core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: RedHatEnterpriseAS
Description: Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Release: 4
Codename: NahantUpdate4

Currently, most of the major Linux distros (UBUNTU, RED HAT, Free BSD etc) comply with the LSB.

3. A not so popular way (which might not work on some distros like Free BSD) would be

bash# cat /etc/*-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)

4. Again, using /etc , we can get

bash# cat /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Kernel \r on an \m

5. Using the boot up messages is another nifty way to get this info :

bash# dmesg | head -1
Linux version 2.6.9-42.ELsmp (bhcompile@hs20-bc1-1.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-2)) #1 SMP Wed Jul 12 23:27:17 EDT 2006



Well, am sure that there might be many more ways to find this info, and if you do know of them, do leave a comment and let me know about it. Each day I realize that there is much more learn/know, that I get even more keen to dwell further into this beast of a Linux.

No comments: