Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This command can only list contents of installed packages,


but how to list contents of a non-installed package, to preview/examine the package?

share|improve this question
up vote 217 down vote accepted

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.

share|improve this answer
apt-file also needs to be updated (sudo apt-file update), and only lists contents for packages in your already-configured Apt repositories. – quack quixote Jan 28 '10 at 22:54
@quackquixote: In Ubuntu 12.04 it's automatic – confiq May 13 '12 at 10:43
dpkg -c nice! – d-_-b Oct 15 '12 at 9:57
The Apt-file answer assumes that your package is coming from a configured repository instead of a .deb file you have downloaded separately. The original question is ambiguous though. – Zoredache Jan 15 '13 at 23:27
@confiq, not by my testing. I'm running 12.04.4 and it still says "E: The cache is empty. You need to run 'apt-file update' first." – Matthew Flaschen Jun 28 '14 at 20:48

Use --contents instead of -L:

dpkg --contents PACKAGENAME

When used in this manner, dpkg acts as a front-end to dpkg-deb, so use man dpkg-deb to see all the options.

You can also use an archive browser to view the package contents.

share|improve this answer
This doesn't work unless I installed it first and then uninstall it. – Xiè Jìléi Dec 15 '09 at 14:07
it should work fine if you give it a .deb file as an argument (instead of PACKAGENAME, give it PACKAGE-DEB-FILE). – quack quixote Dec 15 '09 at 22:11
This answer is wrong. You have to have the package installed first. If you don't have it installed, then you don't have a .deb file. – Neil May 1 '12 at 2:14
This command works for me. For example, I downloaded google-chrome-stable_current_amd64.deb from Google. Then issued the command: dpkg --contents google-chrome-stable_current_amd64.deb and it listed out all the files it will install (mostly to /opt/google/chrome), none of which are currently installed on my system as I type this. (I'm running Xubuntu 11.10 if that matters.) – quux00 Aug 4 '12 at 21:11
@Neil, the answer is not wrong. Just because you have a deb file, doesn't mean it's installed. apt-file needs the entire build-essential package. O.O – d-_-b Oct 15 '12 at 10:00

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.

share|improve this answer
Can I just list the contents without download it? If I'm on a very slow connection, and if the package is too large to download. If the .deb file has a file header where contents list goes, I guess download the whole package maybe not necessary. Is this possible? – Xiè Jìléi Dec 15 '09 at 14:06

The best way would be to browse directly the package repository:[distro name]/all/[package name]/filelist


share|improve this answer

I took @baldoz's http idea and generalized it for Ubuntu and Debian, added a little sed and wrapped it in a bash function one-liner:

function deb_list () { curl -s $(lsb_release -si | sed -e 's Ubuntu ' -e 's Debian ')/$(lsb_release -sc)/all/$1/filelist | sed -n -e '/<pre>/,/<\/pre>/p' | sed -e 's/<[^>]\+>//g' -e '/^$/d'; }


$ deb_list curl

Same function on multiple lines:

function deb_list () {
    curl -s $(lsb_release -si \
                | sed -e 's Ubuntu ' \
                      -e 's Debian '
              )/$(lsb_release -sc)/all/$1/filelist \
      | sed -n -e '/<pre>/,/<\/pre>/p' \
      | sed -e 's/<[^>]\+>//g' -e '/^$/d';


  1. lsb_release -si returns "Ubuntu" or "Debian" replace that with the base url or
  2. lsb_Release -sc returns the codename (e.g. "trusty", "sid", etc) use that to build the full URL:
  3. Fetch that URL with curl and pipe the html through three sed commands. First captures only the file list (what's between <pre> and </pre> tags); second strips out any html tags; third removes any blank lines.

Note: It doesn't search PPAs, alternate apt sources repos and only queries official packages available for the release of debian/ubuntu you are running.

share|improve this answer
Do i need ruby to run it? – Anwar Jul 1 '15 at 7:03
@Anwar, I'd initially used Ruby because I was lazy and multiline regexes suck in sed/awk/grep. But I've rewritten it to use two sed commands, no Ruby required. – notpeter Jul 1 '15 at 16:01
Nice! This is the answer I was looking for – Anwar Jul 1 '15 at 16:37


apt-get download packages-name
dpkg --contents *.deb
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.