Friday, January 4, 2013

Debian/Linux:Check whether a package is installed or not

You might often want to find out whether a certain package is installed(or not installed) on your system.If installed,what is its version and whether it is the most recent release.Here is a simple command for information gathering about a "package" on your system.

On the terminal issue this command
apt-cache policy <packagename>

Remove the <> when specifying the package.

The screenshots below illustrate the usage of this command. 

If the package is installed and up-to date,you will see something like this

If the package is installed but not up-to-date,that is a new release candidate is available,you will see something like this.(Notice the difference between "Installed" and "Candidate" release for the Clamav package)

If the package is not installed,you will see something like this.Here you see the latest release version of the package.This is what will be installed if you want to.

Note that there is a version table too,which indicates the available versions of the package in the repository.

No comments: