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?


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 packages.ubuntu.com: 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.


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
  • 2
    +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.


Isn't this the same question as this How do I find the package that provides a file?

I prefer the dpkg -S <filepath> command

  • If you believe that a question is the same you should flag it as a duplicate so that the moderators can deal with it appropriately. Thank you! – Elder Geek Jan 11 '17 at 1:51
  • Sorry, I missed that. Consider it for future reference then as you are only 4 points off, a couple of approved edits will get you there. – Elder Geek Jan 11 '17 at 19:25
  • No problem, i was just stating it. i'm relatively new here so the suggestion actually helps me :) – Nande Jan 13 '17 at 19:40
  • I'm glad it helps! That's always my intent. :-) – Elder Geek Jan 13 '17 at 21:52

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