Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I've been using dpkg -S <package_name> to list the contents of a package. Sometimes I pipe to grep bin to quickly scan for executables.

I just ran into a case where this didn't work out for me:

$ which virtualenv
$ sudo apt-get install python-virtualenv
Reading package lists... Done
Setting up python-virtualenv ( ...
$ which virtualenv
$ dpkg -S /usr/bin/virtualenv 
python-virtualenv: /usr/bin/virtualenv
$ dpkg -S python-virtualenv | grep bin

/usr/bin/virtualenv seems to be provided by python-virtualenv, but isn't listed in the package contents provided by dpkg -S. All the while, passing /usr/bin/virtualenv to dpkg -S returns that the file comes from python-virtualenv. Can you all explain this?

share|improve this question
-S shows which package provides a file. it doesn't show the contents of a package. At least not in ubuntu 12.10 or debian sid which i'm running currently. – Justin Nov 29 '12 at 5:49
Yeah, I have have been confused by the man entry. So, when -S appears to be listing package contents, it's really just listing files in packages that match the path-spec I'm providing? – dimadima Nov 29 '12 at 5:54
Yes, it appears the correct switch is -L. Yikes. Thank you! – dimadima Nov 29 '12 at 5:55
up vote 1 down vote accepted

Extending from that comment (that dpkg -S only shows what package provides a specified file):

Yeah, exactly. so if you go dpkg -S /bin/bash it will report the bash package, and if you do dpkg -S bash (assuming /bin is in your path) it will do the same.

Also check out apt-file, you have to install it first on most distro's but then you can run 'apt-file list ' and it will show the contents for anything in the repositories you have set up; i.e. you don't have to install it first.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .