Caution

The Packaging and Development guide is currently undergoing a major overhaul to bring it up to date. The current state you are seeing now is a preview of this effort.

The current version is unstable (changing URLs can occur at any time) and most content is not in properly reviewed yet. Proceed with caution and be aware of technical inaccuracies.

If you are an experienced packager and would like to contribute, we would love for you to be involved! See our contribution page for details of how to join in.

Extract packages

This article demonstrates how to extract the contents of Debian packages.

See also the article Package model for a deeper understanding of package formats.

Extract a source package

This section demonstrates how to extract the content of a source package.

Note

A source package archive has the file extension .dsc. See also the manual page dsc(5) for further information.

Important

Make sure that you have the dpkg-dev package installed. To install it, run the following commands in a terminal:

sudo apt update && sudo apt install dpkg-dev

Run the following command in a terminal:

dpkg-source --extract SOURCE-PACKAGE.dsc [OUTPUT-DIRECTORY]
SOURCE-PACKAGE.dsc

The path to the source package control file.

OUTPUT-DIRECTORY (optional)

The path to the directory where to extract the content of the source package to. This directory must not exist. If no output directory is specified, the content is extracted into a directory named NAME-VERSION (where NAME is the name of the source package and VERSION its version) under the current working directory.

See the manual page dpkg-source(1) for further information.

Extract a binary package

This section demonstrates how to extract the content a binary package.

Note

A binary package archive has the file extension .deb. See also the manual page deb(5) for further information.

Run the following command in a terminal:

dpkg-deb --extract BINARY-PACKAGE.deb OUTPUT-DIRECTORY
BINARY-PACKAGE.deb

The path to the binary package control file.

OUTPUT-DIRECTORY

The path to the directory where to extract the content of the binary package to. In comparison to Extract a source package, this directory can already exist and even contain files.

See the manual page dpkg-deb(1) for further information.

Tip

Using --vextract instead of --extract also outputs a list of the extracted files to standard output.

To just list the files that the package contains, use the --contents option:

dpkg-deb --contents BINARY-PACKAGE.deb

Tip

You can also replace dpkg-deb with dpkg for the examples demonstrated here. dpkg forwards the options to dpkg-deb. See the manual page dpkg(1) for further information.