The Version Command in Linux Explored

The Version Command in Linux  Explored
Page content

Introduction

Every application you come across today has a version number or identification. Whether it’s something as your Operating System (Windows Vista, 7, XP, Ubuntu 10.04, 9.10), or something as basic as a multimedia player, new releases are signified by a change or increase in the version identification.

In Linux, finding and keeping up with the latest versions is usually a good practice. Firstly, because you might come across some application that will only run with a certain version of a library, or because a newer updated version of an application has come out that fixes bugs in your current version. Although your package manager will seamlessly upgrade to the latest versions, finding out the version of any application is an important skill.

Kernel and Distribution Versions

The Kernel is the core of the operating system, and in Linux, you will routinely come across kernel upgrades that promise more features or more stability. But how do you find out which kernel you’re currently running? Just open up a terminal window and type the following command:

uname -sr

As you can see, I am passing two parameters with the uname command. The -s switch prints the name of the Kernel, and -r prints the release version of the command. The output?

Linux 2.6.18-164.el5

Don’t worry if you get a different output. This output is taken from my dedicated server running Red Hat Enterprise Linux 5. If you are running a newer operating system, your kernel version will be higher than the output. On a newer machine, this is what I got:

Linux 2.6.33.5-xxxx-grs-ipv4-64

Finding the distribution version is as simply as typing:

cat /etc/*-release

On my newer machine, this is what I have installed:

Distribution

CentOS release 5.5 (Final)

Other applications

With most command-line applications, there is a common switch –version that will show you the version number. Want to test it out? Append the –version switch after any command. For example, I wanted to find the version of the bash shell that I’m running:

I typed “bash –version” and got the following:

bash

GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)Copyright (C) 2005 Free Software Foundation, Inc.

Similarly, if I wanted to find the version of hddtemp, I’d type “hddtemp –version”. Here is what I got:

hddtemp

hddtemp version 0.3-beta15

With graphical applications, the standard method of finding the version number is to go to the Help menu and click on About. However sometimes, software authors do not follow standard convention and this method becomes invalid. In those cases, reading the documentation is the next best alternative.

Getting Help from your Package Manager

With applications, finding the version number is easy enough. But what if you wanted to find out the version info of a library? In most cases, there is no command to run to find out the version. In such a scenario, you can use your package manager to find out which versions of the library you have installed.

The easiest way to accomplish this is by searching in the package manager for the library that you need the version info of. The package manager will list the package and the version that is installed on your system.