I'm not sure if this is more of a SuperUser or UnixLinux question, but I'll try here...

Recently, I found this:

#710689 - aptitude: use unicode character in the trees - Debian Bug report logs

It would be nice when aptitude would use unicode characters for the trees in the dependency lists, e.g. instead of:

--\ Depends (3)
   --- libc-dev-bin (= 2.17-3)
   --- libc6 (= 2.17-3)
   --- linux-libc-dev
 --\ Suggests (2)
   --- glibc-doc (UNSATISFIED)
   --\ manpages-dev


... and I thought - wow, I really like that ASCII-art tree output, wasn't aware that aptitude could do that! So, I start messing for an hour with aptitude command line switches - and I simply cannot get that output? So my initial question was - where does that output come from in the first place?!

After a while, I realized that on my system, aptitude ultimately symlinks to /usr/bin/aptitude-curses; and I finally realized that aptitude has a curses interface! :/

So, I finally run aptitude without any arguments - and so the curses interface starts, and I can see something like this:


... so quite obviously, those ASCII tree characters come from the curses interface.

So I was wondering - is there a Debian/apt tool, which will output such a "visual" ASCII tree - but with actual dependencies of packages?

I know about debtree - Package dependency graphs (also software recommendation - How to visually display dependencies of a package? - Ask Ubuntu); but I'd rather have something in terminal, resembling a directory tree (rather than the "unordered" [in terms of node position] graphs from debtree, generated by graphviz's dot).

I've also seen Is there anything that will show dependencies visually, like a tree?, which recommends:

$ apt-rdepends aptitude
Reading package lists... Done
Building dependency tree       
Reading state information... Done
  Depends: libapt-pkg4.10
  Depends: libboost-iostreams1.42.0 (>= 1.42.0-1)
  Depends: libc6 (>= 2.4)
  Depends: libcwidget3
  Depends: libept1
  Depends: libgcc1 (>= 1:4.1.1)
  Depends: libncursesw5 (>= 5.7+20100313)
  Depends: libsigc++-2.0-0c2a (>= 2.0.2)
  Depends: libsqlite3-0 (>= 3.7.3)
  Depends: libstdc++6 (>= 4.5)
  Depends: libxapian22
  Depends: libbz2-1.0
  Depends: libc6 (>= 2.3.6-6~)
  Depends: libgcc1 (>= 1:4.1.1)
  Depends: libstdc++6 (>= 4.2.1)
  Depends: zlib1g (>= 1:1.1.4)

... which is good, because it lists first the immediate dependencies of the required package; and then the dependencies of the first-level dependency packages, and so on - but it's not visualized as a tree (and actually, aptitude's curses interface simply shows installed info when you expand dependency node; it does not expand to further dependencies).

So, the question is - is there a tool, that would produce a dependency tree graph with terminal characters - like, say, in the following pseudocode:

$ pseudo-deb-graph --show-package="aptitude"

  --- Depends: libapt-pkg4.10
  --\ Depends: libboost-iostreams1.42.0 (>= 1.42.0-1)
     --- Depends: libbz2-1.0
     --- Depends: libc6 (>= 2.4)
  --\ Depends: libc6 (>= 2.3.6-6~)
     --\ Depends: libc-bin (= 2.13-0ubuntu13)
        --- ...
     --\ Depends: libgcc1
        --- ...
     --\ Depends: tzdata
        --- ...

1 Answer 1


You can do it with bash script

Source code: "apt-rdepends-tree"



# sudo apt-get install apt-rdepends
# save gist, above, as "apt-rdepends-tree"
# chmod +x apt-rdepends-tree
# ./apt-rdepends-tree gcc

Output look like this:

# ./apt-rdepends-tree gcc
├─ gcc
│    ├─ cpp (>= 4:4.7.2-1)
│    └─ gcc-4.7 (>= 4.7.2-1)
└─ package-a
     ├─ package-b
     └─ package-c

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .