Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 (1.7.1.2-1) ...
$ which virtualenv
/usr/bin/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
1  
-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

1 Answer 1

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

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.