≡ Menu

HowTo: See Contents of A .DEB Debian / Ubuntu Package File

Under CentOS / Fedora / RHEL I can use rpm -ql packageName command to view contacts of .rpm file. How do I view the contents of a .deb file under Debian / Ubuntu Linux?

You need to install the apt-file command which is a command line tool for searching files in packages for the APT package management system.

Install apt-file

# apt-get update && apt-get install apt-file
Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libapt-pkg-perl libconfig-file-perl liblist-moreutils-perl menu
Suggested packages:
  gksu kdebase-bin kdebase-runtime ktsuss sux
The following NEW packages will be installed:
  apt-file libapt-pkg-perl libconfig-file-perl liblist-moreutils-perl menu
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 626kB of archives.
After this operation, 2687kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.kernel.org lenny/main libconfig-file-perl 1.42-1 [11.7kB]
Get:2 http://mirrors.kernel.org lenny/main libapt-pkg-perl 0.1.22+b1 [89.6kB]
Get:3 http://mirrors.kernel.org lenny/main liblist-moreutils-perl 0.22-1+b1 [51.9kB]
Get:4 http://mirrors.kernel.org lenny/main apt-file 2.1.5 [19.2kB]
Get:5 http://mirrors.kernel.org lenny/main menu 2.1.41 [453kB]
Fetched 626kB in 9s (67.3kB/s)
Selecting previously deselected package libconfig-file-perl.
(Reading database ... 21061 files and directories currently installed.)
Unpacking libconfig-file-perl (from .../libconfig-file-perl_1.42-1_all.deb) ...
Selecting previously deselected package libapt-pkg-perl.
Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.22+b1_amd64.deb) ...
Selecting previously deselected package liblist-moreutils-perl.
Unpacking liblist-moreutils-perl (from .../liblist-moreutils-perl_0.22-1+b1_amd64.deb) ...
Selecting previously deselected package apt-file.
Unpacking apt-file (from .../apt-file_2.1.5_all.deb) ...
Selecting previously deselected package menu.
Unpacking menu (from .../archives/menu_2.1.41_amd64.deb) ...
Processing triggers for man-db ...
Setting up libconfig-file-perl (1.42-1) ...
Setting up libapt-pkg-perl (0.1.22+b1) ...
Setting up liblist-moreutils-perl (0.22-1+b1) ...
Setting up apt-file (2.1.5) ...
You need to run 'apt-file update' as root to update the cache.
Setting up menu (2.1.41) ...
Processing triggers for menu ...

First, resynchronize the package contents from their sources, enter:
# apt-file update

Task: List contents Of a Debian .deb File / Package

The syntax is as follows:
# apt-file list packageName
# apt-file list wget

Sample outputs:

epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/gwget.xml
epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/libgwgetextension.a
epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/libgwgetextension.la
epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/libgwgetextension.so
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/AUTHORS
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/NEWS.gz
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/README
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/THANKS
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/TODO
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/changelog.Debian.gz
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/changelog.gz
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/copyright
gwget: /usr/bin/gwget
gwget: /usr/share/applications/gwget.desktop
gwget: /usr/share/dbus-1/services/gwget.service
gwget: /usr/share/doc/gwget/AUTHORS
gwget: /usr/share/doc/gwget/NEWS.Debian.gz
.....
......
wget-el: /usr/share/emacs/site-lisp/wget-el/wget-sysdep.el
wget-el: /usr/share/emacs/site-lisp/wget-el/wget.el

How Do I See foo.deb Contents?

Type the following command to see contents of a .deb file called foo.deb
# dpkg-deb -c foo.deb
# dpkg-deb -c acct_6.4~pre1-6_amd64.deb

Sample outputs:

drwxr-xr-x root/root         0 2008-03-08 14:26 ./
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/init.d/
-rwxr-xr-x root/root      1787 2008-03-08 14:26 ./etc/init.d/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/default/
-rw-r--r-- root/root       332 2008-03-08 14:26 ./etc/default/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/cron.monthly/
-rwxr-xr-x root/root      1281 2008-03-08 14:26 ./etc/cron.monthly/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/cron.daily/
-rwxr-xr-x root/root       379 2008-03-08 14:26 ./etc/cron.daily/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/sbin/
-rwxr-xr-x root/root     11000 2008-03-08 14:26 ./usr/sbin/dump-utmp
-rwxr-xr-x root/root     12760 2008-03-08 14:26 ./usr/sbin/dump-acct
-rwxr-xr-x root/root     29240 2008-03-08 14:26 ./usr/sbin/sa
-rwxr-xr-x root/root      8184 2008-03-08 14:26 ./usr/sbin/accton
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/bin/
-rwxr-xr-x root/root     21592 2008-03-08 14:26 ./usr/bin/ac
-rwxr-xr-x root/root     20888 2008-03-08 14:26 ./usr/bin/lastcomm
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/doc-base/
-rw-r--r-- root/root       587 2008-03-08 14:26 ./usr/share/doc-base/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/doc/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/doc/acct/
-rw-r--r-- root/root      3994 2003-06-05 22:27 ./usr/share/doc/acct/README
-rw-r--r-- root/root      1247 2008-03-08 14:26 ./usr/share/doc/acct/copyright
-rw-r--r-- root/root     68845 2008-03-08 14:26 ./usr/share/doc/acct/accounting.html
-rw-r--r-- root/root      1601 2006-01-08 04:44 ./usr/share/doc/acct/NEWS.gz
-rw-r--r-- root/root      7105 2008-03-08 14:26 ./usr/share/doc/acct/changelog.Debian.gz
-rw-r--r-- root/root     14612 2006-01-08 04:44 ./usr/share/doc/acct/changelog.gz
-rw-r--r-- root/root      8534 2003-06-05 22:27 ./usr/share/doc/acct/TODO.gz
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/man/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/man/man1/
-rw-r--r-- root/root      1655 2008-03-08 14:26 ./usr/share/man/man1/lastcomm.1.gz
-rw-r--r-- root/root      2381 2008-03-08 14:26 ./usr/share/man/man1/ac.1.gz
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/man/man8/
-rw-r--r-- root/root      3118 2008-03-08 14:26 ./usr/share/man/man8/sa.8.gz
-rw-r--r-- root/root       728 2008-03-08 14:26 ./usr/share/man/man8/dump-utmp.8.gz
-rw-r--r-- root/root       915 2008-03-08 14:26 ./usr/share/man/man8/dump-acct.8.gz
-rw-r--r-- root/root       553 2008-03-08 14:26 ./usr/share/man/man8/accton.8.gz
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/info/
-rw-r--r-- root/root     11307 2008-03-08 14:26 ./usr/share/info/accounting.info.gz

You read the contents of a installed package:
# dpkg -L packageName

A Note About 'apt-file list' And 'dpkg -L'

The apt-file list command list the contents of a package matching the pattern pattern. This action is very close to the dpkg -L command except the package does not need to be installed or fetched.

See also:

  1. apt-get and dpkg command line cheat sheet.
  2. dpkg and apt-file command man page for more information.
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 8 comments… add one }

  • Scott Carlson May 18, 2010, 11:44 am

    Another option to “dpkg-deb -c packageName” is “als packageName” from the atools package. it supports lots of different archive formats, and is nice to have a consistent command.

  • Shawn May 18, 2010, 4:19 pm

    Thank you, This was helpful.

    Shawn

  • chinni May 19, 2010, 5:44 am

    we can get useful info through this how to subscribe this to mail

  • Jostein May 24, 2010, 12:55 pm

    Just browse it with mc (Midnight Commander)

    • Agreed September 23, 2013, 8:14 pm

      Agreed!
      just browse it with mc – you can even browse the PRE and POST install scripts.

  • Axel Burke May 24, 2010, 1:35 pm

    Another option to “dpkg-deb -c packageName” is “als packageName” from the atools package. it supports lots of different archive formats, and is nice to have a consistent command.
    +1

  • sa June 1, 2010, 5:40 am

    you may use dpkg -S to seek which package contains the particular file.
    for eg: dpkg -S /usr/bin/wodim

  • Guy Egozy November 4, 2010, 11:54 pm

    Might be off topic, but if the goal is to find the parent package of a missing file you need on your Debian machine you can use the ‘Search the contents of packages’ at Debian Packages.

Leave a Comment