The apt-file program allows you to search the contents of all debian packages (installed and not installed) for files that you may need. For example, if you're compiling a program and need a header file but don't know which package provides the file, you can use apt-file to find out which package you should install to fix the problem:
# apt-get install apt-file # apt-file update # apt-file search foo.h
Be sure to run apt-file update periodically to update the file listing cache just as you also run apt-get update. The last command above will list any packages whose files match the specified search string, as well as the files that matched:
$ apt-file search bin/lsof lsof: usr/bin/lsof lsof: usr/sbin/lsof
aptapt-fileapt-getcommandsdebianlsofneatutilities
To use apt-get to install a specific (perhaps older) version of a package, follow the package name with an equals sign and the exact version number. For example:
# apt-get install bash=3.0-17
apt-getcommandsdebianneatpackagetroubleshootingversion
If you get strange locale errors when running perl and GTK apps, run these commands and be sure to generate all en_US locales:
$ apt-get install localeconf $ dpkg-reconfigure locales
apt-getcommandsdebiandpkggtklocalelocaleconfperl
If you have packages on your system upon which no others depend, you easily can find out what they are by running the deborphan program. This command will uninstall them:
$ deborphan | xargs apt-get remove
(The --yes switch can be used with apt-get to continue with the removal instead of asking for confirmation.)
apt-getcleanupcommandsdebiandeborphanutilities