Find debian (deb) or RPM package that provides (contains) specific executable or file

You know how to install deb packages with apt-get cmd. But sometimes you need to find the package provides a specific file or executable.

RedHat or CentOS users have this command by default via yum cmd.

yum whatprovides updatedb

This command outputs all packages provide updatedb file (in that case it is an executable).

Ubuntu and Debian users need to install a package to have similar search capability.

First of all you need to install apt-file package:

sudo apt-get install apt-file

Then you need to fetch packages and their contents for the apt-file command to work:

sudo apt-file update

And you can now search within packages (not in package names or descriptions like apt-cache command)

sudo apt-file search updatedb

$ sudo apt-file search updatedb
augeas-doc: /usr/share/doc/augeas-doc/lenses/files/tests/test_updatedb-aug.html
augeas-doc: /usr/share/doc/augeas-doc/lenses/files/updatedb-aug.html
augeas-lenses: /usr/share/augeas/lenses/dist/tests/test_updatedb.aug
augeas-lenses: /usr/share/augeas/lenses/dist/updatedb.aug
locate: /usr/bin/updatedb.findutils
locate: /usr/share/man/man1/updatedb.findutils.1.gz
manpages-es-extra: /usr/share/man/es/man1/updatedb.1.gz
manpages-ja: /usr/share/man/ja/man1/updatedb.1.gz
manpages-pl: /usr/share/man/pl/man1/updatedb.findutils.1.gz
mlocate: /etc/updatedb.conf
mlocate: /usr/bin/updatedb.mlocate
mlocate: /usr/share/man/man5/updatedb.conf.5.gz
mlocate: /usr/share/man/man8/updatedb.8.gz
nss-updatedb: /usr/sbin/nss_updatedb
nss-updatedb: /usr/share/doc/nss-updatedb/README
nss-updatedb: /usr/share/doc/nss-updatedb/changelog.Debian.gz
nss-updatedb: /usr/share/doc/nss-updatedb/copyright
nss-updatedb: /usr/share/man/man8/nss_updatedb.8.gz
roundcube-core: /usr/share/roundcube/bin/updatedb.sh
vim-runtime: /usr/share/vim/vim74/ftplugin/updatedb.vim
vim-runtime: /usr/share/vim/vim74/syntax/updatedb.vim

 

Leave a Reply

Your email address will not be published. Required fields are marked *