apt-get or aptitude Equivalent to yum whatprovides – Package Management

aptaptitude

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?

Best Answer

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.