Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I get a list of files that were or will-be installed when I apt-get a package? Conversely, can I find what package(s) caused a particular file to be installed?

share|improve this question

3 Answers 3

up vote 28 down vote accepted

Note: in the following commands, a command beginning with 'root#' means it needs to be run as root.

To find which files were installed by a package, use dpkg -L:

$ dpkg -L $package

apt-file can tell you which files will be installed by a package before installing it:

root# apt-get install apt-file
root# apt-file update
$ apt-file list $package

Or if you have the package as a .deb file locally already, you can run dpkg on it:

$ dpkg --contents $package.deb

To find which package provides a file that is already on your system, use:

$ dpkg -S /path/to/file

To find which package provides a file that is not currently on your system, use apt-file again:

$ apt-file search /path/to/file
share|improve this answer
    
Thanks. This is exactly what I was trying to find out. (I also checked it out and it works) –  David Nehme Dec 23 '09 at 16:50
2  
Keep in mind that while this will get you most of what you need it will not give you everything. Several packages create configuration files as part of their setup scripts. These files will not be reported by dpkg. –  Zoredache Dec 23 '09 at 17:33
dpkg -S /path/to/file/in/question

As far as I'm concerned, dpkg is the low-level tool that apt-get depends on.

share|improve this answer
    
As far as I'm concerned, it is too :P –  wzzrd Dec 23 '09 at 15:40
    
:) I was not completely sure if this was historical knowledge. However, +1 to Raphinks more thourough answer - haven't seen this before I posted... –  Olaf Dec 23 '09 at 15:42
    
Yes, dpkg is the command that adds and removes software and files from you mcomputer. apt (incl. Apt-get, aptitude, synaptic, etc.) is the programme that calls dpkg –  Rory May 9 '10 at 12:06

If you have installed dlocate, you can use dlocate -L the same way as dpkg -L. It works exactly the same in this case, but has a number of other options.

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.