Tuesday, December 25, 2007

cat /etc/*-release — finding out Linux release version

cat /etc/*-release — finding out Linux release version">

If you have a lot of different Linux distributions installed on many different machines it is easy to forget what distribution version runs on which PC. Well worry not! It is easy enough to findout. On Novell’s Open SuSE Linux, the distribution release information is contained in the /etc/SuSE-release file. Simply cat it to see its content in your terminal.

cat /etc/SuSE-release  # ©2007 dsplabs.com.au

The above command produced the following output on one of our Linux boxes.

SUSE LINUX 10.0 (X86-64) OSS
VERSION = 10.0

The following command is used to findout the release version on RedHat’s Fedora Linux.

cat /etc/redhat-release  # ©2007 dsplabs.com.au

The output will look something like this

Fedora Core release 6 (Zod)

or like this

Fedora release 8 (Werewolf)

depending on what version of Fedora you are running. Thus, the naming convention used should be quite clear by now. If you do not even know what type of the distribution is installed, simply run the following command.

cat /etc/*-release  # ©2007 dsplabs.com.au

On our Ubuntu Linux box the output is as follows.

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

If you really want to know in which file the above information is contained in, then simply run the following find command from shell.

find /etc -iname "*release*"  # ©2007 dsplabs.com.au

For an Ubuntu distribution, the above command produces the following output.

/etc/lsb-release

cat of this file produces same output as above.

No comments: