Introduction
Sometimes you might want a quick and easy way to visualize and understand which packages a given package depends on. With the debtree
package and graphviz
, you can do this in just a few steps.
Installation
Install both debtree
and graphviz
:
apt install debtree graphviz
Visualizing dependencies
If you can specify the package name you want to visualize:
dpkg -l | grep ufw # Check if it exists
You can easily visualize the packages it depends on:
debtree ufw | dot -T png -o ufw_deps.png
Here, I specified -T png
to output a PNG image for embedding in Qiita, but you can choose from many other formats like svg
.
If you have a desktop environment, you can also visualize it instantly using x11
:
debtree ufw | dot -T x11
Visualizing reverse dependencies
To visualize reverse dependencies, you can use the -R
/ --show-rdeps
option.
However, using -R
alone will also display many packages that are not actually installed on your system.
For a cleaner view, add the -I
/ --show-installed
option to limit the output to installed packages only:
debtree -R -I iptables | dot -T x11
From this, you can see that docker-ce
and ubuntu-standard
depend on iptables
.
That’s it for today!
Top comments (0)