-   Debian (
-   -   How to list only files belong to a package (

linuxcrazyguy 04-08-2007 06:01 PM

How to list only files belong to a package
I know about dpkg -L packagename but it lists directories too eg. /lib which doesn't make sense to me.
Is there a simple way to get a list of ONLY FILES belonging to a package?

Thanks guys

MensaWater 04-08-2007 07:18 PM

It makes sense because everything in UNIX/Linux is a "file". A directory is a special type of file. A device is a different type of file. A pipe is a different type of file.

linuxcrazyguy 04-08-2007 07:41 PM

Thanks jlightner but that doesn't help me :), I only need normal (not special directory files) listed.

Does anyone have the answer to my question and how to easily achieve what I'm asking?


rickh 04-08-2007 07:56 PM

Trying to imagine the usefulness of such information. It sounds to me like you're trying to identify a package to install which will supply a missing dependency for another package. You have to do that sort of thing with some distros. Debian's not like that.

I'm sure the command you mention in the OP gives the same information, but here's a link to all the files in the "gaim" (soon to be "pidgin") package. Of course it includes the entire path to the file in question.

MensaWater 04-08-2007 08:02 PM

It helps you by educating you about things that "make sense" to experienced users thereby eliminating misconceptions. :twocents:

However although there don't seem to be any flags that would do what you want this short little script would (assuming the package is installed):


for file in `dpkg -L <packagename>`; do if [ -f $file ];    then echo $file;    fi; done
Just input the name of the package you want in place of <packagename>.

The script tests each file output from the dpkg -L to see if it is a regular file and then outputs it to your display if it is - if it isn't it won't display it.

Using [ -d $file ] in the above would show only the directories.

All times are GMT -5. The time now is 12:49 AM.