Home » Questions » Computers [ Ask a new question ]

How to list files of a Debian package without install

How to list files of a Debian package without install

This command can only list contents of installed packages,

Asked by: Guest | Views: 99
Total answers/comments: 5
Guest [Entry]

"dpkg -c (or --contents) lists the contents of a .deb package file (It is a front-end to dpkg-deb.)

dpkg -c package_file.deb

To work directly with package names rather than package files, you can use apt-file. (You may need to install the apt-file package first.)

sudo apt-file update
apt-file list package_name

As stated in the first comment, apt-file lists contents for packages in your already-configured Apt repositories. It is irrelevant whether any particular package is or is not installed."
Guest [Entry]

"dpkg --contents will let you look at the uninstalled package. If the .deb is not on your system yet, do

apt-get --download-only install pkgname

The package will get downloaded to /var/cache/apt/archives but not installed."
Guest [Entry]

"For all those people who might still googling this issue at Jan 2017, you can have some cool stuff with recent versions of apt and dpkg in Debian 8.5 without downloading anything.

List Contents of Deb File Without Download:

First locate the full url of the deb file :

root@debian:apt-get --print-uris download yade
'http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb' yade_2016.06a-7_amd64.deb 1621148 SHA256:26c0d84484a92ae9c2828edaa63243eb764378d79191149970926aa3ec40cdd4

PS: --print-uris switch prints the url of deb package but deb is not downloaded.

Then display contents of deb package without downloading it:

root@debian:curl -sL -o- ""http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb"" |dpkg-deb -c /dev/stdin
drwxr-xr-x root/root 0 2016-12-10 22:18 ./
drwxr-xr-x root/root 0 2016-12-10 22:18 ./usr/
drwxr-xr-x root/root 0 2016-12-10 22:18 ./usr/bin/
-rwxr-xr-x root/root 13184 2016-12-10 22:18 ./usr/bin/yade
.........................more files listed bellow ......................

PS: Same result can be achieved with

root@debian:dpkg -c <(curl -sL -o- ""http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb"")

Extract a file from the above deb package , without download.
For example we want to read man page of package yade without installing this package and without even downloading the deb package.

Filename of man page inside deb package as advised by dpkg -c is ./usr/share/man/man1/yade.1.gz

To read man page on the fly:

root@debian:curl -sL -o- ""http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb"" |dpkg-deb --fsys-tarfile /dev/stdin |tar -xO ./usr/share/man/man1/yade.1.gz |man /dev/stdin

man page is displayed correctly using man application.

PS: Above pipes does not work with ar command.

root@debian:apt --version --> apt 1.4~beta2 (amd64)
root@debian:dpkg --version --> Debian 'dpkg' package management program version 1.18.18 (amd64).
root@debian:man --version --> man 2.7.6.1
root@debian:tar --version --> tar (GNU tar) 1.29"
"For all those people who might still googling this issue at Jan 2017, you can have some cool stuff with recent versions of apt and dpkg in Debian 8.5 without downloading anything.

List Contents of Deb File Without Download:

First locate the full url of the deb file :

root@debian:apt-get --print-uris download yade
'http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb' yade_2016.06a-7_amd64.deb 1621148 SHA256:26c0d84484a92ae9c2828edaa63243eb764378d79191149970926aa3ec40cdd4

PS: --print-uris switch prints the url of deb package but deb is not downloaded.

Then display contents of deb package without downloading it:

root@debian:curl -sL -o- ""http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb"" |dpkg-deb -c /dev/stdin
drwxr-xr-x root/root 0 2016-12-10 22:18 ./
drwxr-xr-x root/root 0 2016-12-10 22:18 ./usr/
drwxr-xr-x root/root 0 2016-12-10 22:18 ./usr/bin/
-rwxr-xr-x root/root 13184 2016-12-10 22:18 ./usr/bin/yade
.........................more files listed bellow ......................

PS: Same result can be achieved with

root@debian:dpkg -c <(curl -sL -o- ""http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb"")

Extract a file from the above deb package , without download.
For example we want to read man page of package yade without installing this package and without even downloading the deb package.

Filename of man page inside deb package as advised by dpkg -c is ./usr/share/man/man1/yade.1.gz

To read man page on the fly:

root@debian:curl -sL -o- ""http://httpredir.debiandotorg/debian/pool/main/y/yade/yade_2016.06a-7_amd64.deb"" |dpkg-deb --fsys-tarfile /dev/stdin |tar -xO ./usr/share/man/man1/yade.1.gz |man /dev/stdin

man page is displayed correctly using man application.

PS: Above pipes does not work with ar command.

root@debian:apt --version --> apt 1.4~beta2 (amd64)
root@debian:dpkg --version --> Debian 'dpkg' package management program version 1.18.18 (amd64).
root@debian:man --version --> man 2.7.6.1
root@debian:tar --version --> tar (GNU tar) 1.29"
Guest [Entry]

"Try:

apt-get download packages-name
dpkg --contents *.deb"
Guest [Entry]

"Seems it's not possible before installing it first or extracting the list from .deb file.

Try the following command:

dpkg --contents <(curl -s $(apt-get install --yes --no-download --reinstall --print-uris language-pack-en | tail -n1 | grep -o ""http[^']\+""))

Change language-pack-en with your package name.

It basically reads .deb file extracted via curl and run dpkg --contents FILE on it.

You can also check the content without downloading the package file.

So if you know the URL of .deb file, the following shell command will list all the package files:

dpkg -c <(curl -sL ""http://httpredir.debiandotorg/debian/pool/main/a/avis/avis_1.2.2-4_all.deb"")

Curl params: -s - silent, -L - follow moved links.

If you don't know the URL, fetch by: apt --print-uris, e.g.

apt --print-uris install avis | grep avis"