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.

Jorge Castro
  • 71,754
Magnus
  • 1,413
  • 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 '15 at 13:54
  • 1
    Yes, but the duplicate on that question has been asked a month earlier. – jazzpi Jun 08 '15 at 08:30
  • @jazzpi The question listed in the closing reason is not closed as duplicate of another question. – apaderno Aug 27 '17 at 08:59
  • @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 03 '17 at 11:14

3 Answers3

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.

MestreLion
  • 20,086
ajmitch
  • 18,543
  • 1
    I misread that as apt-rdepends, which I'd already installed. It's probably worth pointing out that they're not the same. – Roger Lipscombe Sep 29 '13 at 08:28
  • 2
    Also,apt-cache rdepends jetty will show you packages that break (and, i suppose, conflict with) jetty. – thor Oct 04 '13 at 12:42
  • 49
    This helped me, but only the --installed flag made it perfect! – dualed Jan 01 '14 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.

    – Matthew Flaschen Jul 03 '14 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) – Vahid Pazirandeh Nov 16 '17 at 05:23
  • 2
    For the output, why do some of the packages have a vertical bar (pipe symbol) before them? – Vahid Pazirandeh Nov 16 '17 at 05:35
  • For completeness, do not forget 'apt depends' for dependencies in the other direction as compared to 'rdepends'. – Timo Feb 22 '19 at 13:51
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...
tshepang
  • 1,967
  • 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 08 '11 at 18:28
  • 1
    @fli You made me look closer at my answer, and I have corrected it. Thanks. – tshepang Feb 08 '11 at 20:49
  • 1
    It shows more info than apt rdepends. – Timo Mar 22 '18 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).