In order to research what caused the installation of a given package, I'd like to get a list of packages which depend on that package. I couldn't find anything obvious in man dpkg.

  • Related: askubuntu.com/questions/13296/… – Seth Feb 26 '15 at 3:58
  • 5
    The older question's answers all revolve around aptitude, something that hasn't been installed by default for years. In 2017, everyone on Ubuntu still has apt-cache. Anyone who follows the linked question is going to get lost in a discussion about a program few will have. – Lambart Aug 18 '17 at 17:48

apt-cache rdepends packagename should do what you want

  • 1
    Excellent! apt-cache rdepends tofrodos confirmed the suspicion that it was installed by another package (the obsoleted dos2unix). – l0b0 Apr 30 '12 at 13:12
  • Good deal. I do wish there was a recursive option. Sadly there is not as far as I am aware. – RobotHumans Apr 30 '12 at 13:27
  • 1
    As for today (apt version, there is --recurse option that works with rdepends. – jarno Dec 22 '13 at 14:00
  • 32
    If you add --installed, the output is even useful for packages which can be used by many others: apt-cache rdepends --installed packagename – quazgar May 27 '14 at 22:08
  • 4
    For the output, why do some of the packages have a vertical bar (pipe symbol) before them? – Vahid Pazirandeh Nov 16 '17 at 5:35

aptitude has a fairly nice way of handling this:

$ aptitude why bash
i   foomatic-filters PreDepends bash (>= 2.05)

By default, it only lists the "most installed, strongest, tightest, shortest" reason, but you can use aptitude -v why to make it output everything it finds.

  • 4
    Seems like it considers only the installed packages, not everything available. And that was what I needed. – Tuukka Mustonen Jul 25 '13 at 10:06
  • 3
    For that you want reverse-depends in ubuntu-dev-tools – tumbleweed Jul 25 '13 at 11:38
  • How about debian? – Tuukka Mustonen Jul 25 '13 at 12:08
  • 1
    ubuntu-dev-tools is in Debian – tumbleweed Jul 26 '13 at 11:18
  • This is great. I learned that openssh-server recommended (and therefore installed) xauth on a headless server, dragging in hundreds of x11 dependencies and dozens of useless updates a month. That's the problem with automated package management! – BaseZen Mar 2 '18 at 3:17
apt-cache showpkg <pkgname> 


apt-cache showpkg lightdm

There is more than one way, with each method showing a different output.

For a detailed view of the full reverse dependency tree;

aptitude install apt-rdepends
apt-rdepends -r bash


apt-cache showpkg bash

Or a concise list:

apt-cache rdepends bash
  • What exactly does rdepends show in that tree? apt-rdepends php7.0-fpm shows sed. sed doesn't depend on PHP, let alone PHP FPM. – Dan Dascalescu Jan 9 '18 at 23:21
  • It is reverse depends, it means that PHP depends on sed. – Erik Berkun-Drevnig Apr 25 '18 at 3:30
  • Hi guys, actually "apt-rdepends" stands for "recursive dependency". If you want reverse recursive dependency, you have to type : apt-rdepends -r yourPackageNameHere – SebMa Apr 27 '18 at 12:56
  • The apt-cache man page says "rdepends shows a listing of each reverse dependency a package has". Whereas apt-rdepends requires the -r option to do reverse dependencies, as @SebMa says. – Anil G Feb 5 at 3:16

In addition to other good answers, doing:

sudo apt -s remove <pkgname>

( -s Does a "simulated" removal. )

The removal command will normally list any dependencies/programs/libraries that will be affected or that can removed (orphaned) along with specified pkg. (If they exist.)

  • apt remove -s php7.0-fpm shows The following additional packages will be installed: apache2 apache2-bin apache2-data libapache2-mod-php7.0 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0. Why would apache get installed if I remove PHP FPM? – Dan Dascalescu Jan 9 '18 at 23:22
  • @DanDascalescu Hmm. Might be a bad install/remove script for apt pkg or might be you have some other dependencies that install apache2 as dep (meaning a webserver is needed - and I believe apache2 is default web server). Could be a few things. Just not sure. Has the smell of a good post on AskUbuntu if you haven't found an answer. – bshea Jul 10 '18 at 16:26

The simplest option is still:

apt rdepends package-name

which does not require you to install any package.

  • 1
    What is this adding to the accepted answer? – l0b0 Nov 26 '18 at 23:58
  • 2
    The accepted answer has nothing to do with this one. The output is completely different and way more useful for human consumption than apt-cache's. The answer mentions that apt-cache is not installed by default everywhere - that alone should be a rather good hint why this answer has its purpose. finally, this is actually the answer I was looking for, so any downvote is rather silly. – stefanct Nov 28 '18 at 13:21
  • One very significant reason why this is better than the accepted version is that it includes the version of the dependencies, unlike apt-caches output. It's exactly what I needed right now (debugging a glibc 2.28 incompatibility, so upvoting) – Per Lundberg Jan 2 at 9:10

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.