Extract deb package on Ubuntu / Debian Linux System

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

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.

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

Using ar command

You can also use the ar command with –x parameter. The ar command is provided by binutils package.

sudo apt update
sudo apt install binutils tree -y
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

Confirm:

$ 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

Confirm directory contents:

$ tree extrated/
extrated/
└── usr
    └── share
        └── doc
            └── mysql-apt-config
                ├── COPYING.gz
                ├── README
                ├── changelog.Debian.gz
                └── copyright

4 directories, 4 files

There you have it. You have successfully extracted a deb package.

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button