apt Ubuntu

How can examine the contents of a .deb package?

Reading Time: < 1 minute

Last Edited: 2/27/2022

Debian files are standard unix archives. The archive contains two TAR files. one named “control.tar” which contains the control information and another named “data.tar”

The Control file will contain a number of standard files which detail the security and package details.

ar x {file.deb}
$ tar xvf control.tar.gz
$ tar data.tar.gz
$ ls -l

Eample: The following ( on most days ) is not publicly available

 wget http://archive.midwestnoc.com/dists/thamilton/main/binary-amd64/helloworld_1.0-1_amd64.deb
--2022-02-27 19:05:11--  http://archive.midwestnoc.com/dists/thamilton/main/binary-amd64/helloworld_1.0-1_amd64.deb
Resolving archive.midwestnoc.com (archive.midwestnoc.com)... 70.63.41.42
Connecting to archive.midwestnoc.com (archive.midwestnoc.com)|70.63.41.42|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2552 (2.5K) [application/vnd.debian.binary-package]
Saving to: ‘helloworld_1.0-1_amd64.deb’

helloworld_1.0-1_am 100%[===================>]   2.49K  --.-KB/s    in 0s

2022-02-27 19:05:11 (250 MB/s) - ‘helloworld_1.0-1_amd64.deb’ saved [2552/2552]
# ar -x helloworld_1.0-1_amd64.deb
# ls -la
total 24
drwxr-xr-x 2 root root 4096 Feb 27 19:07 .
drwx------ 6 root root 4096 Feb 27 19:07 ..
-rw-r--r-- 1 root root  448 Feb 27 19:07 control.tar.gz
-rw-r--r-- 1 root root 1912 Feb 27 19:07 data.tar.xz
-rw-r--r-- 1 root root    4 Feb 27 19:07 debian-binary
# tar -xvf data.tar.xz
./
./usr/
./usr/bin/
./usr/bin/helloworld
./usr/share/
./usr/share/doc/
./usr/share/doc/helloworld/
./usr/share/doc/helloworld/changelog.Debian.gz
./usr/share/doc/helloworld/copyright

How do I view contents of a Debian package without extracting it?

dpkg -I package.deb
$ dpkg -c {file.deb}

or


$ apt-file list {packageName}

URL Referenced Material:
https://en.wikipedia.org/wiki/Deb_(file_format)
https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/

Related posts

installing sftp server on Ubuntu

user

CORE STUDY: Installing wordpress on Ubuntu

Tom Hamilton

Creating an APT Package

Tom Hamilton