Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 11 down vote accepted

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).

share|improve this answer
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

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
share|improve this answer

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.

share|improve this answer

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

share|improve this answer
    
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

 
discard

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.