For Debian and Ubuntu users there are three easy ways to find what package a file on your system is from. Those Red Hat, Fedora, or CentOS over to a Debian or Ubuntu system may have become used to using ‘yum whatprovides’. There is no whatprovides equivalent in aptitude or apt-get. But there are three easy to use debian/ubuntu alternatives to ‘yum whatprovides’: the Ubuntu packages search web site, the apt-file package, and the ‘dpkg -S’ command.
Ubuntu Packages Search
The first method is simple: Ubuntu provides a web site where you can search the package repositories and pull up detailed information on the packages. Visit the Ubuntu Packages Search site. Scroll down to the section titled “Search the contents of packages”, which will search file manifests and all other package information. Enter in the path of the file you are looking for, such as “/etc/ssl/certs/ca-certificates.crt” or “ca-certificates.crt”. and hit search. Very easy to use.
The apt-file tool can also substitute for ‘yum whatprovides’. The apt-file package must first be installed using aptitude or apt-get. Simply run an ‘aptitude install apt-file’ to install it.
After you install the apt-file package, you must run ‘apt-file update’ to update it’s files database. Remember to run ‘apt-file’ update if you haven’t used it in a while, to make sure your apt-file database is up to date.
Now to determine the package a file is from, use the ‘apt-file search’ command. Here’s an example which shows the base packages my apache2 web server is currently using:
# apt-file search /usr/sbin/apache2 apache2-dbg: /usr/lib/debug/usr/sbin/apache2-mpm-event apache2-dbg: /usr/lib/debug/usr/sbin/apache2-mpm-prefork apache2-dbg: /usr/lib/debug/usr/sbin/apache2-mpm-worker apache2-mpm-event: /usr/sbin/apache2 apache2-mpm-itk: /usr/sbin/apache2 apache2-mpm-prefork: /usr/sbin/apache2 apache2-mpm-worker: /usr/sbin/apache2 apache2.2-common: /usr/sbin/apache2ctl
Another way to find the package name is using ‘dpkg -S’. This command will quickly tell you the package name it originated from. However it will only work for packages already install on your system. You can also use ‘dpkg -S’ without providing a full path for a very broad search.
Let’s find out what package the python binary /usr/bin/python is from:
# dpkg -S /usr/bin/python python-minimal: /usr/bin/python
Let’s find out what package /usr/bin/python-config is from:
# dpkg -S /usr/bin/python-config python-dev: /usr/bin/python-config