Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

How can I check dependency list for a deb package. I am running Ubuntu 11.10 and I have backed up all deb packages from var/cache/apt/archives. I want to format my pc and re-install selected applications only. Also how can I get the list of installed packages and dependencies.

share|improve this question
For your second question see… – htorque Nov 19 '11 at 9:15
up vote 24 down vote accepted

In addition to the dpkg method, you can check the dependencies of packages in the repository:

apt-cache showpkg package-name
share|improve this answer

This will show you all the information about the package:

dpkg -I package.deb
share|improve this answer
That no longer works on Ubuntu 14.04: dpkg -I splunkforwarder-6.3.3-f44afce176d0-linux-2.6-amd64.deb new debian package, version 2.0. size 15881308 bytes: control archive=3104 bytes. 153 bytes, 5 lines control 6058 bytes, 207 lines * postinst #!/bin/bash 2912 bytes, 93 lines * preinst #!/bin/bash Package: splunkforwarder Version: 6.3.3 Maintainer: Splunk Inc. <> Architecture: amd64 Description: Splunk The platform for machine data. – Craig S. Anderson Mar 8 at 22:08

Here is some sloppy, and probably not very encompassing post-processing you can do to dpkg -I output to get dependency items as a list:

Condensed for computers

# dpkg -I package.deb | python -c "import sys, re; t=re.split(r'\n(?= ?[\w]+:)|:',; print '\n'.join([i.strip() for i in {key.strip(): value.strip() for key, value in zip(t[::2], t[1::2])}['Depends'].split(',')])"

Expanded for humans:

dpkg -I package.deb | python -c "
    import sys, re;
    # Split keys and values into pairs (zipped together later)
        r'\n(?= ?[\w]+:)|:',
    # Newline separate each dependency
    print '\n'.join([
        # Trim each dependency value
        i.strip() for i in {
            # Build assoc array from package metadata
            key.strip(): value.strip() 
            for key, value in zip(t[::2], t[1::2])
share|improve this answer
This will echo the packages which depend on 'foo.deb' and have yet to be installed: dpkg -I foo.deb | for i in $(awk -F', ' '/Depends: /{gsub(/: /, ", "); for (i=2; i<=NF; i++) { gsub(/ .*$/, "", $(i)); printf("%s\n", $(i)); } }'); do dpkg -s $i &> /dev/null || echo $i; done | tr '\n' ' ' – Gregory Burd Sep 17 '15 at 14:48
@GregoryBurd, Feel free to edit my answer/psot all you like, I posted it as community wiki for this reason ^u^ – ThorSummoner Sep 17 '15 at 16:35

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.