Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How do I find the package that provides a file?

When you type a command in the terminal in Ubuntu that you have not installed but can supplied by a package Ubuntu will suggest the package to be installed.

How do I do the other way around? How do I look for what package supplied the command I am typing in a terminal?

dpkg -S /usr/bin/termit


termit: /usr/bin/termit

apt-file find /usr/bin/termit


termit: /usr/bin/termit

Where termit is an terminal emulator supplied by package termit.

enter image description here

share|improve this question

marked as duplicate by James, Marco Ceppi Nov 25 '11 at 13:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Supplied solutions do not work in 11.10. – Bruno Pereira Oct 27 '11 at 22:27
Uh? I don't have 11.10 to check, but I'd be very surprised if dpkg -S didn't work, it's a basic command that doesn't change over time, and you even seem to be saying in your edited question that it does work. apt-file find should work too, though you might need to run sudo apt-file update once and for all first (previous versions of Ubuntu did it automatically when you installed the apt-file package). In what way are dpkg -S and apt-file find (which were given as answers here as well as in the earlier similar question) unsuitable? – Gilles Oct 27 '11 at 22:36
Then either I am doing it wrong or there is something wrong, anyways a solution would be nice. Included a screen shot, let me know if something is wrong. Thanks for the comment anyways. apt-file find was run after update. – Bruno Pereira Oct 27 '11 at 22:45
Could you rephrase your question then? As far as I can tell, the screenshot shows you getting the answer you wanted, which is that the file /usr/bin/termit is provided by the package termit. – Gilles Oct 27 '11 at 22:47
Holy sh*t big fail, really. It works as it should. Just sleepy I think. Thanks for forcing it down :) – Bruno Pereira Oct 27 '11 at 22:51
up vote 5 down vote accepted

If you have apt-file installed and configured, you can do:

apt-file find <filename>

This is also handy when you're looking for a command that you don't have installed yet, e.g. if you're working from instructions seen on the web that use a command you don't have.

If you only want to query packages that are installed, you can use:

dpkg -S <pattern>

E.g. for a file that is installed:

% apt-file find /usr/bin/oodraw /usr/bin/oodraw
% dpkg -S oodraw /usr/share/man/man1/oodraw.1.gz /usr/bin/oodraw

and for a file that is not installed:

% dpkg -S /usr/bin/python3.1
dpkg: /usr/bin/python3.1 not found.
% apt-file find /usr/bin/python3.1
python3.1-dbg: /usr/bin/python3.1-dbg
python3.1-dbg: /usr/bin/python3.1-dbg-config
python3.1-dbg: /usr/lib/debug/usr/bin/python3.1
python3.1-dbg: /usr/lib/debug/usr/bin/
python3.1-dbg: /usr/lib/debug/usr/bin/
python3.1-dev: /usr/bin/python3.1-config
python3.1-minimal: /usr/bin/python3.1
share|improve this answer
This is not giving me what I am looking for. ie: apt-file find termit returns everything expect the name of the package that installed termit. `apt-file find /usr/bin/termit' only returns the path to the file. – Bruno Pereira Oct 27 '11 at 21:04
Nice. I didn't know about apt-file. – zpletan Oct 27 '11 at 22:55
Note that for apt-file to be useful, you have to run apt-file update first -- it takes a while to build the database the first time, but after that finding what you want is quick. (Usually quicker than dpkg -S.) – bstpierre Oct 27 '11 at 22:57

If you are using /usr/bin/ls (you can find absolute paths of executables via the which command), you can find what package provided by running:

dpkg -S /usr/bin/ls

Alternatively, running

dpkg -S ls

will search for files named ls (or some heuristic like that) in all installed packages and return a list of them for you, formatted as PACKAGE: /path/to/file.

share|improve this answer
This is not what I want, I know they are installed, I know where they are, I want to know where they are coming from. – Bruno Pereira Oct 27 '11 at 21:01

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