Debian: Package Dependency in Graph

Bruce Wen
1 min readJun 19, 2021

--

To visualize package dependency relationship in Linux is one attractive feature. This article will show how to do that in Debian OS.

Create DOT file by apt-cache

The command apt-cache has one sub-command dotty which is able to take a list of packages on the command line and generates output suitable for
use by dotty from the GraphViz package.

apt-cache dotty docker-ce > docker-ce.dot

Convert DOT file to graph file

The command dot can convert DOT file to different graph file formats.

dot -Tjpg docker-ce.dot > docker-ce.jpg
Figure 1: docker-ce dependency graph

To avoid large graph

In default, apt-cache dotty will trace out all dependent packages and produce a very large graph DOT file. To limit the output to only the packages listed on the command line, set the APT::Cache::GivenOnly option in apt.conf file (/etc/apt/apt.conf).

Note: need root permission to edit apt.conf file.

APT
{
// Options for apt-get
Get
{
Download-Only "false";
};
Cache
{
GivenOnly "true";
}

};

That’s it and hope it’s helpful for you.

Thanks and happy reading!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Bruce Wen
Bruce Wen

Written by Bruce Wen

⚬ A coder, a writer, and an artist.

No responses yet

Write a response