How to extract packages¶
This article demonstrates how to extract the contents of Debian packages. See also the article Package format 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 you have the dpkg-dev package installed. To install it:
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.dscThe 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(whereNAMEis the name of the source package andVERSIONits 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 the manual page deb(5) for further information.
Run:
dpkg-deb --extract <BINARY-PACKAGE>.deb <OUTPUT-DIRECTORY>
BINARY-PACKAGE.debThe path to the binary package control file.
OUTPUT-DIRECTORYThe path to the directory where to extract the content of the binary package. 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 shown here. dpkg forwards the options to dpkg-deb. See the manual page dpkg(1) for further information.