deb is a format and software packaging extension for the Linux distribution from Debian family and its derivatives. In this guide, we will explore how to extract a .deb package file. This is relevant to Software developers working on Debian related applications.
Debian applications are packaged as regular ar archives. A Debian package generally has three main files:
- debian-binary: regular text file which stores the version of the deb package format.
- control.tar.gz: This compressed file contains file md5sums and control directory for the deb package.
- data.tar.xz: Contains all the installation files.
There are two common ways of unpacking a deb package.
Using ar command
You can also use the ar command with –
x parameter. The ar command is provided by binutils package.
sudo apt -y install binutils tree wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb ar -x mysql-apt-config_0.8.13-1_all.deb
If you want more verbose output, add the
-v argument like this:
$ ar -xv mysql-apt-config_0.8.13-1_all.deb x - debian-binary x - control.tar.xz x - data.tar.xz
$ tree . ├── control.tar.xz ├── data.tar.xz ├── debian-binary └── mysql-apt-config_0.8.13-1_all.deb 0 directories, 4 files
Using dpkg command
If you’re running a Debian based system. you can use dpkg command to extract a .deb package. Let’s consider an example.
wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb mkdir extrated dpkg -x mysql-apt-config_0.8.13-1_all.deb extrated
There you have it. You have successfully extracted a deb package.