131

I was wondering if it was possible to check what package another package is a dependency of.

For example, jetty is mysteriously installed and running on my system and I'd like to check whether it is a dependency of something else.

5
  • 3
    The question that this is marked a duplicate of was asked a year and a half after I asked this one
    – Magnus
    Feb 26, 2015 at 13:54
  • 1
    Yes, but the duplicate on that question has been asked a month earlier.
    – jazzpi
    Jun 8, 2015 at 8:30
  • @jazzpi The question listed in the closing reason is not closed as duplicate of another question.
    – apaderno
    Aug 27, 2017 at 8:59
  • @kiamlaluno Not anymore
    – jazzpi
    Sep 3, 2017 at 9:55
  • @jazzpi Right, so the argument the question was closed as duplicate of a question asked one year and a half later so the users can see a link to a question asked a month earlier doesn't hold anymore, since that link is not visible up-front anymore.
    – apaderno
    Sep 3, 2017 at 11:14

3 Answers 3

175

You can use apt-cache rdepends --installed jetty to see what depends on jetty. This will show both depends & recommends, so you may want to check through the list of packages to see what the relationship is with jetty.

7
  • 2
    Also,apt-cache rdepends jetty will show you packages that break (and, i suppose, conflict with) jetty.
    – thor
    Oct 4, 2013 at 12:42
  • 49
    This helped me, but only the --installed flag made it perfect!
    – dualed
    Jan 1, 2014 at 17:26
  • 2
    @thor, yeah, it includes Depends, Recommends, Replaces, and Conflicts, which is unintuitive. However, you can turn this off with --no-pre-depends --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances as desired. There is also --no-depends, but normally for rdepends you want that. There is also --installed, which limits to installed packages. Jul 3, 2014 at 23:38
  • 3
    There's a slightly different syntax which helped me to differentiate between Recommends, Depends, Suggests, etc. Syntax is sudo apt rdepends jetty (Notice it is not using apt-cache but simply apt) Nov 16, 2017 at 5:23
  • 2
    For the output, why do some of the packages have a vertical bar (pipe symbol) before them? Nov 16, 2017 at 5:35
20

Go install apt-rdepends. It doesn't only show immediate dependencies, but all the recursive ones, so will tend to give you a large output. So, use a pager as well.

  • To display recursive depends: $ apt-rdepends jetty | pager. Note that this will list exactly the same depends multiple times. Output of apt-rdepends 1.3.0 isn't trivial for scripting as package name doesn't appear along each line...
  • To display recursive reverse depends: $ apt-rdepends --reverse jetty | pager. Note that this will return all packages, not just installed...
3
  • 11
    The OP was asking for reverse dependencies, not recursive dependencies. Confusingly, apt-rdepends and apt-cache rdepends do very different things despite their similar appearance.
    – Flimm
    Feb 8, 2011 at 18:28
  • 1
    @fli You made me look closer at my answer, and I have corrected it. Thanks.
    – tshepang
    Feb 8, 2011 at 20:49
  • 1
    It shows more info than apt rdepends.
    – Timo
    Mar 22, 2018 at 14:12
7

If you open Synaptic and find the package, you can right click on it and select Properties. Under the tab Dependencies you can see the packages that jetty depend on, and which packages is dependent on jetty (the dropdown list).

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