Posted: . At: 1:20 PM. This was 5 years ago. Post ID: 13657
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


List the contents of a deb package before installation.


A Debian deb package is an archive that contains files to be installed on your system. There are ways to list the contents of a deb package before installation. Use the dpkg(1) command to achieve this easily.

List all files in the deb archive.

┌─[][jason@darkstar][~]
└──╼ $dpkg --contents brave.deb

List all files that are installed in the /usr/bin directory.

┌─[][jason@darkstar][~]
└──╼ $dpkg --contents brave.deb | grep "/usr/bin"
drwxrwxr-x root/root         0 2016-07-19 05:59 ./usr/bin/
lrwxrwxrwx root/root         0 2016-07-19 05:59 ./usr/bin/brave -> ../share/brave/brave

This is how to list all files for a package that is already installed.

┌─[][jason@darkstar][~]
└──╼ $dpkg -L vim
/.
/usr
/usr/bin
/usr/bin/vim.basic
/usr/share
/usr/share/doc
/usr/share/bug
/usr/share/bug/vim
/usr/share/bug/vim/script
/usr/share/bug/vim/presubj
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/vim
/usr/share/doc/vim

It is possible to repackage an already installed package into a deb archive. Install the dpkg-repack utility.

┌─[jason@darkstar][~]
└──╼ $sudo apt install dpkg-repack

Then we can repackage VIM into a deb archive, for installation on another machine, but this would still require any dependencies.

┌─[jason@darkstar][~]
└──╼ $sudo dpkg-repack vim
dpkg-deb: building package 'vim' in './vim_7.4.1689-3ubuntu1.3_amd64.deb'.

Now I have a Debian deb archive of VIM ready to be installed again.

┌─[jason@darkstar][~]
└──╼ $ls -hula vim*.deb
-rw-r--r-- 1 root root 1012K Oct 14 13:12 vim_7.4.1689-3ubuntu1.3_amd64.deb

This is very easy to do, and could come in very useful in the future.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.