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.

share|improve this question
    
Related: askubuntu.com/questions/13296/… – Seth Feb 26 '15 at 3:58
3  
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
up vote 140 down vote accepted

apt-cache rdepends packagename should do what you want

share|improve this answer
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 0.9.9.1), there is --recurse option that works with rdepends. – jarno Dec 22 '13 at 14:00
    
Thanks for the heads up. /me is even more pleased than he was. – RobotHumans Dec 22 '13 at 22:50
18  
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

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.

share|improve this answer
2  
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
2  
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
apt-cache showpkg <pkgname> 

Example:

apt-cache showpkg lightdm
share|improve this answer

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

For a detailed view of the dependency tree;

aptitude install apt-rdepends
apt-rdepends bash

Alternatively;

apt-cache showpkg bash

Or a concise list:

apt-cache rdepends bash
share|improve this answer

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.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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