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?
- 293
- 5
- 11
4 Answers
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
).
- 95,029
- 29
- 173
- 228
-
1+1 You can use dlocate instead of dpkg -S to make the searching almost instantaneous, but you need to install it. http://packages.ubuntu.com can also be used instead of apt-file if you want to save bandwidth. – David Pashley Jun 24 '09 at 06: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
- 2,846
- 19
- 13
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,887
- 14
- 12
You can also use apt-cache search [file] to check the local caches for the app.
- 4,678
- 2
- 26
- 21
-
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 03:33
-
womble, I do not know what goes wrong at your end, but for me what Tim Howland suggests works "apt-cache search xprop" and "apt-cache search remmina". – frog.ca Sep 03 '21 at 14:06