Introduction
A .deb file is a software package for Debian, Ubuntu, Linux Mint and the
other Linux distributions built on Debian. It holds the files to install, a description
of the package with the other packages it depends on, and scripts to run before and
after installing or removing it. The dpkg tool installs it, and APT fetches
packages and their dependencies from repositories.
Structure
A .deb file is an ar archive, the same simple format Unix uses
for static libraries. It starts with the 8 bytes !<arch>\n, and each
member after that has a 60-byte text header giving its name, date, owner, mode and size.
A package has three members, always in this order:
debian-binary, a text file holding the format version,2.0.control.tar, compressed (ascontrol.tar.gz,.xzor.zst), holding thecontrolfile that names the package and its version and dependencies, plus the install scripts.data.tar, compressed the same ways, holding the files to install, laid out as they will be on disk.
0ar magic!<arch>\n8 bytes8debian-binary: member header, then2.0\n64 bytes72control.tar.*: member header, then the compressed tarvaries…data.tar.*: member header, then the compressed tarvaries
Links
Software
- dpkg (Debian and its derivatives)
- APT (Debian and its derivatives)
- GNU Binutils, whose
arunpacks the outer archive (Linux, macOS, Windows) - 7-Zip (Windows)
Reference
- deb(5), the format’s manual page
- Debian Policy Manual, including the control file fields