Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

How can I recognise in ubuntu from which package was command installed?

share|improve this question
up vote 2 down vote accepted

dpkg -S filename will find the package that filename came from. Use the full path. Searching for /usr/sbin/apache2 will find just that file, but searching for apache2 will give a long list.

To find the full path of a command use which as in which apache2.

You can also search the .list files in /var/lib/dpkg/info. This directory also lists the confiration files in the .confiles files. File names consist of the package name with a extension indicating the contents. This is likely the directory that the dpkg searches.

share|improve this answer
Now that's the way to do it. I realize now that I should probably learn APT a bit more even though I seldom need to use it for more advanced purposes. – cmbrnt Jan 15 '11 at 16:15
@cmbrnt I usually just search the directory, as it saves me running man dpkg to find the right switch. – BillThor Jan 15 '11 at 16:21
If it's a file that's not in the path, which won't find it. You could use locate (or find) to find it in that case. – Dennis Williamson Jan 15 '11 at 18:13
dpkg -S $(which filename) should work if you only know the short filename and not the full path, at least for an executable program. – frabjous Jan 15 '11 at 18:14

One way of doing this (sometimes) is to run "apt-cache search <command>", which sometimes displays the package name. Don't quote me on this, but I think this depends on the information given in the verbose description of the package in the APT-repository. It might be the names of the files in the .deb-package, but that's less likely.

This is the method I use at least, and it works most of the time. Otherwise, Google usually helps.

share|improve this answer

Your Answer


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.