Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an equivalent to the yum "whatprovides" option in apt-get?

For example on CentOS

yum whatprovides /usr/share/gdm/themes/TreeFlower/background.png

Tells me

redhat-logos-4.9.99-11.el5.centos.noarch : CentOS-related icons and pictures.
Repo        : base
Matched from:
Filename    : /usr/share/gdm/themes/TreeFlower/background.png

Can I get similar functionality on the command line in Ubuntu?

share|improve this question
In nower days it is yum provides in Fedora. There is a very nice summary for the differences of package management tools from Fedora/Red Hat to Ubuntu/Debian: RedHatEnterpriseLinuxAndFedora/ – erik Feb 16 '14 at 14:01
up vote 16 down vote accepted

This depends on whether the package containing the file is already installed. If so, use dpkg -S filename.

If your intention is to find out which package to install to get a certain file, one option is to use the online scroll down to "Search the contents of packages". Make sure that the right distribution is selected. If you're looking for a files irrespective of the path, check the appropriate option.

There is also apt-file. Because this method required updating the files database, however, I prefer the other, instant option.

share|improve this answer
+1 Yes the dpkg -S works perfectly for my needs. – Richard Holloway Aug 17 '10 at 16:09 really is a gem that doesn't seem to get mentioned often enough. It's inherited of course from – thomasrutter Dec 1 '15 at 23:08

You want the 'apt-file' command.

apt-file search /usr/share/gdm/themes/TreeFlower/background.png

Before using it, you may need to create or update its database by running:

apt-file update
share|improve this answer
+1 this does seem to be useful but is not installed by default on my machine so I am modding you up but accepting loevborg answer – Richard Holloway Aug 17 '10 at 16:09

wajig whichpkg /usr/share/gdm/themes/TreeFlower/background.png

You'll have to install wajig, which is a frontend to a bunch of utilities related to apt. If you use wajig, you can use all of those tools without having to memorize their names.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.