Search for a Debian Package
Methods for searching for a package
Find a package that is already installed
1. Use dpkg
To search for an installed package including the file "toto":
dpkg -S toto
To search for the package "toto":
dpkg -l toto
It is often preferable to generalize, and search for all packages with "toto" in their name:
dpkg -l '''toto'''
or, like this, with grep:
dpkg -l | grep toto
2. Use the package, dlocate
This program does, more or less, the same thing as dpkg, but it does it even quicker. For more information, see man dlocate
Find an official package (installed or not)
1. Use apt-cache (available since Debian 2.2)
apt-cache allows searching rapidly among the entire list of available Debian packages. The most current usage is to use the "search" option with a rational expression as a parameter.
apt-cache search emacs
This will post the names of all packages containing the expression "emacs" in the name or description. If you wish to search only for those packages with the search expression in the name, add the option --names-only:
apt-cache search --names-only emacs
To learn more about a listed package use:
apt-cache show packagename
This will provide a more complete description of the package named "packagename". Clearly, if you wanted to see such information for, say, emacs, you would use:
apt-cache show emacs
Another option is to use aptitude search.
aptitude search emacs
This will basically provide the same information as apt-cache search.
2. Ask robots irc
Connect to the irc server at irc.debian.org, join channel #debian, then: (with "toto" as the name of the package or file): (translator note: I believe this is outdated, and one needs to connect to irc.freenode.net, then join #debian. I do KNOW this can be done on #debian on freenode, anyway. Perhaps it is an alternative option?)
% <mt> /msg dpkg !find toto <dpkg> toto is in package: bla...bla
To search for a package in a specific distribution, such as the current Stable, named "squeeze", try
% <mt> /msg dpkg !find toto squeeze
3. Search the Debian website
Try here: http://www.debian.org/distrib/packages
The Debian site has had a built in search engine for some time.
A package that has been removed from Debian
For various reasons, a package may be removed from Debian and no longer be easily accessible. In this case, try here: http://snapshot.debian.org
This site covers all Debian packages, including those which have been removed from Debian due to excessive bugs, security problems, etc. It does not, however, retain packages that have been removed for licensing issues.
The site offers a classic, but configurable, package recovery system (Debian sources):
- by absolute date (YYYY/MM/DD)
- by relative date (format date)
- by package name
An unofficial package
For various reasons, it may be useful (or necessary) to install "unofficial" Debian packages, not provided in the official Debian sources. There a a myriad of unofficial sources, each meeting a particular need (specifically configured or recompiled applications, for instance).
We have a site to identify and evaluate the quality of "unofficial" sources.
Site for finding unofficial sources: http://www.apt-get.org
Any random package?
What follows are two rather general methods for finding packages. The first is use to search for a package (or it could be used to find a config file, easily enough), and the second is used to find a file.
1. Run grep on the apt-get files. This works for all packages that you can install with
meaning, those available in the repositories listed in your /etc/apt/sources.list
These files are available in /var/lib/apt/lists
To be certain that this list is current, you first may want to run
Example : Search for the cddb package:
grep -h -15 "Package: cddb" /var/lib/apt/lists/* || pager
- The '-h' is to pass the name of the file in which the occurrence of the search term is found.
- The -15 in grep is to see 15 lines before and 15 lines after each occurrence of the found term in the search.
- Specify "Package:" to reserve the search only to the package, cddb, and exclude packages which depend on cddb, or which conflict with it.
This gives (among other junk):
Package: cddb Priority: optional Section: sound Installed-Size: 86 Maintainer: Adrian Bridgett <email@example.com> Architecture: i386 Source: xmcd Version: 2.6-10 Replaces: xmcd (<=2.3-1) Depends: libc6 (>= 2.2.3-7) Conflicts: suidmanager (<<0.50) Filename: pool/main/x/xmcd/cddb_2.6-10_i386.deb
2. Run grep on a file Contents-<arch_.gz (This file is made for that). This works to search for a package even if not installed from the official distribution (or from the unofficial packages, if the sources have been designed and such a file made available). This file can be found in various locations:
- On a CDRom (Clearly, one must have the CD for this to work, and this works, as such, only for users of Debian Stable). This file is found at:
% <mount point>''dists''<distribution>/Contents-<arch>.gz
- On the official ftp sites, the path is similar:
% <ftp address>''dists''<distribution>/Contents-<arch>.gz