6

Frequently I know the name of the command line program that I need but I don't know the name of the package that provides the program. How do I find the name of the package that contains the program that I need? On RPM based systems they have the whatprovides option rpm -q --whatprovides /usr/X11R6/bin/xclock which will find the correct package. Is there anything similar for Debian based systems?

13

If the package is installed, you want dpkg -S /path/to/file. If the package isn't installed, then use the apt-file utility (apt-file update; apt-file search /path/to/file).

  • 1
    +1 You can use dlocate instead of dpkg -S to make the searching almost instantaneous, but you need to install it. packages.ubuntu.com can also be used instead of apt-file if you want to save bandwidth. – David Pashley Jun 24 '09 at 6:56
7

Ubuntu has a command-not-found utility which will tell you which package to install to get a specific command. If configured correctly (perhaps in the default install?) it will show up when you enter a command that isn't installed. However, you can also run it manually:

$ /usr/lib/command-not-found --ignore-installed test
The program 'test' is currently not installed.  You can install it by typing:
sudo apt-get install coreutils
2

Ubuntu, as does Debian, comes with the apt-file application. This allows you, quite similar to apt-get, to just search for files in packages.

Thus, you'd have

$ apt-file update
$ apt-file search xclock

And there you go. If you're lucky, you can also use the interface at the bottom of the Debian packages site. This will work if the Ubuntu maintainers haven't changed that much compared to the original Debian version.

-1

You can also use apt-cache search [file] to check the local caches for the app.

  • dpkg -S /usr/bin/reduce-font => libbogl-dev; apt-cache search reduce-font and apt-cache search /usr/bin/reduce-font both return nothing. Care to expand your answer? – womble Jun 24 '09 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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