This article briefly shows you how to look inside a .deb file on a Debian or Ubuntu Linux.
List the content of an installed package
With the option -L we ask dpkg to list the content of an installed package by providing it the package name e.g. apache2.
$ dpkg -L apache2
/.
/usr
/usr/share
/usr/share/bug
/usr/share/bug/apache2
/usr/share/bug/apache2/control
/usr/share/doc
/usr/share/bug/apache2/script
/usr/share/doc/apache2
With dpkg -l you get listed all your installed packages on your system.
List the content of a package before being installed
There are two different ways of how to inspect the content before installing a package.
- Download the package for local inspection. You achieve this either with aptitude or apt-get.
aptitude download anacron apt-get --download-only anacronThen inspect the package as follows while providing it the option
-cor the equivalent--contents.dpkg --contents anacron_2.3-14_amd64.deb dpkg -c anacron_2.3-14_amd64.debYou won’t just get a list of the containing files but the output will also tell you the file permissions, owner and group as well.
drwxr-xr-x root/root 0 2009-11-02 04:48 ./ drwxr-xr-x root/root 0 2009-11-02 04:48 ./etc/ drwxr-xr-x root/root 0 2009-11-02 04:48 ./etc/cron.d/ -rw-r--r-- root/root 244 2009-11-02 04:48 ./etc/cron.d/anacron drwxr-xr-x root/root 0 2009-11-02 04:48 ./etc/init.d/ -rwxr-xr-x root/root 1336 2009-11-02 04:48 ./etc/init.d/anacron drwxr-xr-x root/root 0 2009-11-02 04:48 ./etc/cron.daily/ -rwxr-xr-x root/root 311 2009-11-02 04:48 ./etc/cron.daily/0anacron drwxr-xr-x root/root 0 2009-11-02 04:48 ./etc/cron.weekly/ -rwxr-xr-x root/root 312 2009-11-02 04:48 ./etc/cron.weekly/0anacron ... -
An alternative to
dpkg -cyou can use the APT package searching utility. Before listing the content you should/must update the package database.$ sudo apt-file update $ apt-file list anacronThe output will differ slightly. The file permissions are missing here and the directories won’t be displayed seperately.
anacron: /etc/anacrontab anacron: /etc/apm/event.d/anacron anacron: /etc/cron.d/anacron anacron: /etc/cron.daily/0anacron anacron: /etc/cron.monthly/0anacron anacron: /etc/cron.weekly/0anacron anacron: /etc/init.d/anacron anacron: /usr/lib/pm-utils/power.d/anacron anacron: /usr/lib/pm-utils/sleep.d/95anacron anacron: /usr/sbin/anacron anacron: /usr/share/doc/anacron/README.Debian anacron: /usr/share/doc/anacron/README.gz anacron: /usr/share/doc/anacron/TODO anacron: /usr/share/doc/anacron/changelog.Debian.gz anacron: /usr/share/doc/anacron/changelog.gz anacron: /usr/share/doc/anacron/copyright anacron: /usr/share/man/man5/anacrontab.5.gz anacron: /usr/share/man/man8/anacron.8.gz
Featured image mixed from kaelin.fe on flickr and Debian on wikipedia.