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?


4 Answers 4


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

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.

  • 2
    whatprovides wajig though?
    – Dokbua
    Jun 3, 2022 at 8:25

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

  • 4
    dpkg -S <filepath> only works if the package is already installed. I think the OP was asking how to find which package they might want to install that would provide that.
    – James Harr
    May 31, 2022 at 19:08
  • dnf also works with wildcards. Command dnf whatprovides */background.png will find all packages with file named background.png in any directory.
    – nobody
    Dec 1, 2022 at 18:08

Not the answer you're looking for? Browse other questions tagged .