How the Linux command line can create a graphical tree of package dependencies.

Posted: April 11, 2017. At: 1:32 PM. This was 4 months ago. Post ID: 10450

Image unknown. Some decoded SSTV image.
Image unknown. Some decoded SSTV image.

The Linux command line may be used to create a graphical display of package dependencies. This is good for visualizing what other components of Ubuntu are required for a certain package to operate. And the images look very cool when put on a website as well.

Firstly, install the graphviz package.

ubuntu ~ $ sudo apt-get install graphviz

Then run this command to get information about bash.

ubuntu ~ $ apt-cache -o APT::Cache::GivenOnly=1 dotty bash | dot -T png > out.png

The generated image will look like this.

Dependencies tree of bash.
Dependencies tree of bash.

This one is for the nmap package.

Tree of dependencies for nmap.
Tree of dependencies for nmap.

This is a very nice tip for those who are using Linux distributions that have the apt package manager and wish to visualize how packages are interrelated and have many dependencies.

Here is another very cool trick.

ubuntu ~ $ printf 'You are a bigot. \b\b\b\b\b\b\bwonderful person.\n' | pv -qL 10
You are a wonderful person.

This command will print “You are a bigot.”, then it will backspace and edit it to say “You are a wonderful person.”. Very funny Linux trick.

You need to sudo apt install pv to use this cool command.

No comments have been made. Use this form to start the conversation :)

Leave a Reply