I'm using Lubuntu 13.10 which doesn't include gedit by default. But I have installed it using

sudo apt-get install --no-install-recommends gedit

Now, when I run apt-cache depends gedit, zenity and yelp are among recommends.

But when I run apt-cache showpkg gedit, zenity and yelp are under Dependencies (third line from bottom in the code below).

3.8.3-0ubuntu3 - libatk1.0-0 (2 1.12.4) libc6 (2 2.14)
libcairo2 (2 1.2.4) libenchant1c2a (2 1.6.0)
libgdk-pixbuf2.0-0 (2 2.22.0) libgirepository-1.0-1 (2 0.9.3) 
libglib2.0-0 (2 2.37.3) libgtk-3-0 (2 3.7.10)
libgtksourceview-3.0-1 (2 3.2.0) libpango-1.0-0 (2 1.14.0)
libpeas-1.0-0 (2 1.1.0) libx11-6 (0 (null)) libxml2 (2 2.7.4)
libzeitgeist-2.0-0 (2 0.9.9) gedit-common (2 3.8)
gedit-common (3 3.9) gsettings-desktop-schemas (0 (null))
python3-gi (2 3.0) python-gi-cairo (2 3.0) 
gir1.2-peas-1.0 (0 (null)) iso-codes (0 (null)) 
gedit-plugins (0 (null)) zenity (0 (null)) yelp (0 (null)) 
gedit-plugins (3 2.91) gedit-plugins:i386 (3 2.91) 
gedit:i386 (0 (null)) 

Why is that? Is the output of apt-cache depends and apt-cache showpkg influenced by software already present on my system and by whether I use --no-install recommends? And what does (0 (null)) mean?

What I'm seeing is with a fully updated system. In other words, I have run sudo apt-get update && sudo apt-get dist-upgrade and then tried the apt-cache commands.

  • use apt-get update then do the above commands Commented Oct 27, 2013 at 9:01
  • No difference at all.
    – user15760
    Commented Oct 27, 2013 at 10:26

2 Answers 2


Sadly the dependency list is not translated into human readable form. The dependencies are in the form:

packagename (compareOp value)

compareOp is one of the following numbers:

 0 NoOp
 1 LessEq
 2 GreaterEq
 3 Less
 4 Greater
 5 Equals
 6 NotEquals

possibly added with

16 OR

OR means, that this dependency can be satisified by the following dependency as well, so only one of the "or"ed dependencies needs to be there.

NoOp has no value, hence you see those (0 (null)) outputs, as this is, how a NULL string is printed by the C library. Well, yes, there is absolutely no translation!

And I did not find any way to find out, which of the dependencies are mandatory, suggested, conflicts and so on. To get all information, at first run

apt-cache depends PACKAGE

to list the dependencies in human form. Sadly this lacks the details. And then find the details about dependencies with

apt-cache showpkg PACKAGE

Perhaps somebody else finds a better way (or creates a tool) to list the dependencies of a package with all needed gory detail in human readable form.

I tried to put this together into some script called showdeps, which seems to do the job. It is called like this: showdeps package..

The output is very similar to apt-cache depends package.., but includes a bit more detail.

As a reference I copy it here, original is at https://github.com/hilbix/bashy/blob/debian/showdeps


export LC_ALL=C.UTF-8

export PKG="$1"
gawk '
NR==1,/^Dependencies:/  { next }
/^Provides:/,0      { next }
END { if (NR==0) { print "No input, package " ENVIRON["PKG"] " not found?"; exit(1); } }

    OP[0]   = "";
    OP[1]   = "<=";
    OP[2]   = ">=";
    OP[3]   = "<<";
    OP[4]   = ">>";
    OP[5]   = "==";
    OP[6]   = "!=";
    for (a in OP) OP[a+16]=OP[a];

  delete pkg;
  delete cmp;
  j = 0;
  for (i=3; i<=NF; i+=3)
      pkg[j] = $i;
      x = $(i+1); sub(/^[(]/,"",x);
      y = $(i+2); sub(/[)]$/,"",y);
      x = (x in OP) ? OP[x] : "### OOPS, unknown >>>" x "<<<";
      if (x=="")
        if (y=="(null)")
          y = "";
          x = "???OOPS???";
      cmp[j] = x y;
  exec="apt-cache depends \"$PKG\"='\''"ver"'\''";
  j = 0;
  while (exec | getline)
      printf "%s\t%s\t%s%s\n", ENVIRON["PKG"], ver, $0, ($1~/:$/) ? "\t(" cmp[j++] ")" : "";
  print ""
' <(apt-cache showpkg "$1")

for p
    showdep "$p"

This is free software with free as in free speech, free beer and free baby. No warranty, use at your own risk, and you cannot hold me liable for any error in it.

Example output:

$ showdeps gedit
gedit   3.10.4-0ubuntu4 gedit
gedit   3.10.4-0ubuntu4   Depends: libatk1.0-0  (>=1.12.4)
gedit   3.10.4-0ubuntu4   Depends: libc6        (>=2.4)
gedit   3.10.4-0ubuntu4   Depends: libcairo2    (>=1.2.4)
gedit   3.10.4-0ubuntu4   Depends: libenchant1c2a       (>=1.6.0)
gedit   3.10.4-0ubuntu4   Depends: libgdk-pixbuf2.0-0   (>=2.22.0)
gedit   3.10.4-0ubuntu4   Depends: libgirepository-1.0-1        (>=0.9.3)
gedit   3.10.4-0ubuntu4   Depends: libglib2.0-0 (>=2.38)
gedit   3.10.4-0ubuntu4   Depends: libgtk-3-0   (>=3.10)
gedit   3.10.4-0ubuntu4   Depends: libgtksourceview-3.0-1       (>=3.10.0)
gedit   3.10.4-0ubuntu4   Depends: libpango-1.0-0       (>=1.14.0)
gedit   3.10.4-0ubuntu4   Depends: libpeas-1.0-0        (>=1.1.0)
gedit   3.10.4-0ubuntu4   Depends: libx11-6     ()
gedit   3.10.4-0ubuntu4   Depends: libxml2      (>=2.7.4)
gedit   3.10.4-0ubuntu4   Depends: libzeitgeist-2.0-0   (>=0.9.9)
gedit   3.10.4-0ubuntu4   Depends: gedit-common (>=3.10)
gedit   3.10.4-0ubuntu4   Depends: gedit-common (<<3.11)
gedit   3.10.4-0ubuntu4   Depends: gsettings-desktop-schemas    ()
gedit   3.10.4-0ubuntu4   Depends: python3-gi   (>=3.0)
gedit   3.10.4-0ubuntu4   Depends: python-gi-cairo      (>=3.0)
gedit   3.10.4-0ubuntu4   Depends: gir1.2-peas-1.0      ()
gedit   3.10.4-0ubuntu4   Depends: iso-codes    ()
gedit   3.10.4-0ubuntu4   Suggests: gedit-plugins       ()
gedit   3.10.4-0ubuntu4   Recommends: gir1.2-gtksource-3.0      ()
gedit   3.10.4-0ubuntu4   Recommends: zenity    ()
gedit   3.10.4-0ubuntu4     zenity:amd64
gedit   3.10.4-0ubuntu4   Recommends: yelp      ()
gedit   3.10.4-0ubuntu4   Breaks: gedit-plugins (<<2.91)
gedit   3.10.4-0ubuntu4   Breaks: gedit-plugins:amd64   (<<2.91)
gedit   3.10.4-0ubuntu4   Conflicts: gedit:amd64        ()
  • 1
    Do you know what is 18 in compareOp ?
    – EdiD
    Commented Jun 1, 2019 at 17:17
  • 1
    @EdiD This is 16+2 where 16 means OR and 2 means >=. The dependency (which includes the OR) can be fulfilled >= with the given version OR it can be fulfilled with the next dependency. The OR is shown as a | (pipe symbol) in the output (which means: the current line and the next line belong together). The OR can be repeated on the next line, then it spans 3 lines (always one line more than there are ORs). (Edited to make my answer more clear.)
    – Tino
    Commented Jun 1, 2019 at 19:46

For apt-cache showpkg it lists each dependency, recommendation or suggestion as dependencies, it also includes how many dependencies there are after installing those packages (the 0/null). There is no distintion between recommends and suggestions. From the man:

Forward (normal) dependencies are those packages upon which the package in question depends

Checking the source code of the cmdline/apt-cache.cc:

  cout << "Dependencies: " << endl;
  for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
     cout << Cur.VerStr() << " - ";
     for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; ++Dep)
        cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
     cout << endl;

The interesting part is the DependsLists() function. With my limited knowledge of C++ this function is the responsible of defining what package are dependencies, but haven't found where this function resides.

You must log in to answer this question.