How to visually display dependencies of a package?

debtree

According to the application's website, the debtree package provides "package dependency graphs on steroids".

Note: This is also very useful when planning software upgrades. This application is able to graph dependencies against packages which have not yet been installed on your system. This will read from the sources.list file (usually located at /etc/apt/sources.list) and it will perform a live query using that list.

The following diagram is an example of running debtree against the package dpkg. Here is a map of its dependencies:

To install debtree from the command line(Ctrl-Alt-t) enter the command:

sudo apt-get install debtree

Usage

  • Create a .dot file (a directed graph drawing - see the man dot manpage)

    debtree --with-suggests <package> >out.dot
    
  • Create a graph (PNG) from a .dot file

    dot -T png -o out.png out.dot
    
  • Create a graph (Postscript) and view it using Okular

    debtree <package> | dot -Tps | okular - &
    

Be aware that when running this application against larger packages (i.e. gedit), the images can quickly become unwieldy and illegible.

Note that apt-rdepends can also be used in a similar manner, but piping output into a graphic is a bit more convoluted, in my opinion.

See also: Ubuntu debtree man page


Maybe not so "graphical" but if you prefer not installing any extra packages you also have the possibility to just run

apt-cache rdepends <package>

You may also want to take a look to depends option.

You also have:

  • apt rdepends <package>
  • Use this script, apt-rdepends-tree <package>
  • apt-rdepends <package> or as debtree apt-rdepends --dotty package | springgraph > dependencies.png