When you aren't exactly sure which Ubuntu package has the files you need, use these handy command-line tools to find out.
The Ubuntu package-management system is truly impressive. Simply choose a package name, and Ubuntu will automatically download and install it along with any dependencies it may have. What happens, though, when you don't know the exact name of the package you want to install? The graphical package manager Synaptic has a search tool, but there are two separate command-line tools, apt-cache and apt-file, that you'll find are even more powerful. Each tool suits a particular type of search. apt-cache lets you search for a package based on keywords (among some of its other uses), and apt-file allows you to search for a package based on files inside that package. Each approach is useful in different circumstances, and this hack introduces you to how to use both tools effectively.
The apt-cache tool is
actually much more than a keyword-based package search utility.
apt-cache is a general tool used to
query and manipulate the apt package cache. To
search within the apt package cache, use the
search argument followed by one or
more keywords. For instance, if you wanted to find packages having to
do with Adobe's Acrobat Reader, you could run the following
apt-cache search acrobat readerxpdf - Portable Document Format (PDF) suite xpdf-utils - Portable Document Format (PDF) ...