Suppose you are trying to install a specific deb package, but want to know what files are contained in the package before actual installation. Or imagine that you are not sure what package owns a specific program binary or library you need.
In these cases, it will be useful if you can check the content of a specific deb package before installation. This article tells you how to do it.
In Ubuntu or Debian, there are two ways to show all files contained in a particular deb package without installing it.
The first method is to use apt-file command-line tool.
To install and use apt-file on Ubuntu or Debian, do the following.
$ sudo apt-file update
Note that you need to run "apt-file update" at first, in order to synchronize all available package contents from their sources.
Then to show files belonging to a specific deb package (e.g., tofrodos), simply run:
tofrodos: /usr/bin/fromdos tofrodos: /usr/bin/todos tofrodos: /usr/share/doc/tofrodos/NEWS.Debian.gz tofrodos: /usr/share/doc/tofrodos/changelog.Debian.gz tofrodos: /usr/share/doc/tofrodos/copyright tofrodos: /usr/share/doc/tofrodos/readme.txt.gz tofrodos: /usr/share/doc/tofrodos/tofrodos.html tofrodos: /usr/share/man/man1/fromdos.1.gz tofrodos: /usr/share/man/man1/todos.1.gz
The output will show the names of all contained files, along with their respective target installation directories.
The second method to show files in a Debian package is to use apt-get command, but with "--download-only" option.
Once you run the above command, a deb package called tofrodos will get downloaded to /var/cache/apt/archives, but will not be installed.
Then you can use dpkg command to list contents of the locally downloaded deb package.
drwxr-xr-x root/root 0 2011-10-18 10:47 ./ drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/ drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/share/ drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/share/man/ drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/share/man/man1/ -rw-r--r-- root/root 1677 2011-10-18 10:47 ./usr/share/man/man1/fromdos.1.gz drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/share/doc/ drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/share/doc/tofrodos/ -rw-r--r-- root/root 391 2011-10-18 10:47 ./usr/share/doc/tofrodos/NEWS.Debian.gz -rw-r--r-- root/root 1406 2011-10-18 10:47 ./usr/share/doc/tofrodos/copyright -rw-r--r-- root/root 5832 2011-02-27 04:25 ./usr/share/doc/tofrodos/tofrodos.html -rw-r--r-- root/root 3746 2011-10-18 10:47 ./usr/share/doc/tofrodos/changelog.Debian.gz -rw-r--r-- root/root 5410 2011-02-27 04:25 ./usr/share/doc/tofrodos/readme.txt.gz drwxr-xr-x root/root 0 2011-10-18 10:47 ./usr/bin/ -rwxr-xr-x root/root 12792 2011-10-18 10:47 ./usr/bin/fromdos lrwxrwxrwx root/root 0 2011-10-18 10:47 ./usr/share/man/man1/todos.1.gz -> fromdos.1.gz lrwxrwxrwx root/root 0 2011-10-18 10:47 ./usr/bin/todos -> fromdos
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to back up a WordPress website to remote cloud storage from the Linux command line - November 24, 2015
- How to access Dropbox from the command line in Linux - November 22, 2015
- How to send email notifications using Gmail SMTP server on Linux - November 9, 2015