HOWTO Extract DEB packages
Contents |
Introduction
DEB packages is a container for other files. A DEB file is a pure ar archive. So, it should be possible to unpack their content using standard archiving tools, regardless of the package format. Under normal conditions, you should use your distribution’s standard package manager, dpkg and its frontends, to manage those files. But, if you need to be more generic, here is how to do it.
Two-step way
DEB files are ar archives, which contain three files:
- debian-binary
- control.tar.gz
- data.tar.gz
As you might have already guessed, the needed archived files exist in data.tar.gz. It is also obvious that unpacking this file is a two-step process.
Extract the content of a DEB
First, extract the three files from the DEB file:
| Command: extracting MYPACKAGE.deb |
# ar vx MYPACKAGE.deb |
Then extract the content of data.tar.gz using tar:
| Command: extracting data.tar.gz |
# tar -xzvf data.tar.gz |
List the content of a DEB
if you just need to get a listing of the files:
First, extract the three files from the DEB file:
| Command: extracting MYPACKAGE.deb |
# ar vx MYPACKAGE.deb |
Then list the content of data.tar.gz using tar:
| Command: listing the content of data.tar.gz |
# tar -tzvf data.tar.gz |
Again the -v option in both ar and tar is used in order to get verbose output. It is safe not to use it. For more information, read the man pages of tar and ar.
One-step way
Extract the content of a DEB
The content of data.tar.gz can be extracted from the DEB package in a one step process as shown below:
| Command: extracting MYPACKAGE.deb |
# ar p MYPACKAGE.deb data.tar.gz | tar zx |
List the content of a DEB
The content of data.tar.gz can be listed from the DEB package in a one step process as shown below:
| Command: listing the content ofMYPACKAGE.deb |
# ar p MYPACKAGE.deb data.tar.gz | tar tx |