Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to visualize package dependencies in Ubuntu

📅 2013-Mar-14 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_3310" align="aligncenter" width="732"][Dependency graph of the package of the nano editor.]( Dependency graph of the package of the nano editor.[/caption]

In the Ubuntu package system, a package is dependent on many other packages and there can be other packages that are dependent on it. Thus, the Ubuntu package system is a huge complicated directed graph, with the packages as vertices and dependencies as directed edges.

It would be nice to sometimes to visually see the dependency graph of a package. That is, to see the graph of all packages that a given package is dependent on.

This can be done easily by using debtree. It can be easily installed from the Ubuntu repositories by using the package name debtree.

When invoked with the name of an installed package, it outputs its dependency graph to the standard output in the Dot format. This output can be redirected to a Dot file. I prefer to open this Dot file using Dot viewers like xdot to see the graph visually.

For example, to get the dependency graph of the package of the nano editor and view it:

$ debtree nano >
$ xdot

Thanks to the folks who answered my question on Ask Ubuntu.

Tried with: Ubuntu 12.04 LTS