Posted by chantra on June 6th, 2006
This tutorial will bring you through dpkg, the debian package manager. As I introduce apt, I will now introduce dpkg and show how to search which files are installed by a package, which packages are installed on your system ....
Search packages containing a file:
It happens quite often that you use binaries and want to know which package contains it. Let's take the example of gaim, searching file containing bin/gaim will look like this:
$dpkg -S bin/gaim
Getting installed package:
searching for packages intalled on your system which are named gaimsomething is achieved by triggering the following command:
$ dpkg --get-selections 'gaim*'
This actually give you the packages named like as well as their status (install|deinstall|purge), install stands for installed on your system ;), deinstall means that the package has been removed but that the configuration files were kept, and purge means that the package was deinstalled plus all the configuration files coming along with.
Getting installed versions:
When a package is installed on your system, you might want to know which version it is. In the following example, the gaim version is 220.127.116.11beta3 and the debian revision 2ubuntu0, a brief summary of the package comes with as well as the package'state (ii,un,pn..):
$ dpkg -l 'gaim*'
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
ii gaim 2.0.0beta3-2ubuntu0 multi-protocol instant messaging client un gaim-common (no description available)
ii gaim-data 2.0.0beta3-2ubuntu0 multi-protocol instant messaging client - data files
ii gaim-dev 2.0.0beta3-2ubuntu0 multi-protocol instant messaging client - development files
un gaim-gnome (no description available)
Getting all files installed by a package:
Once a package is installed, you can get all the files installed by that package by trigerring the following command line:
$dpkg -l gaim
This can be pretty usefull to locate the configuration files of a software.
Getting the status of a package:
Finally, you can get the status of a package with the -s switch, this will output the state of the package along with the list of package it depends on, plus the description of the package.
$dpkg -s gaim
Hope this helps :),