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.
8 Answers
apt-cache rdepends packagename should do what you want.
To limit it to packages that are installed on your system: apt-cache rdepends --installed packagename
- 3,699
- 30,112
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.
- 1,470
- 8,106
The simplest option is still:
apt rdepends package-name
which does not require you to install any package.
- 807
In addition to other good answers, an apt/apt-get -s does a "simulated" removal (or install).
sudo apt -s remove <pkgname>
Using -s or --simulate to remove (or install) packages, will normally list any dependencies affected. It will show orphaned packages when removing, or needed dependencies when installing, without actually executing the install or remove. Informational only.
- 16,703
- 1,252
Since the --installed option of apt-cache was mentioned in comments of RobotHumans's answer and does not make much sense as the matching is done against all versions, including uninstalled ones (see Debian bug 1029586), here's the solution proposed by Julian Andres Klode to get the reverse dependencies among the installed packages:
apt list '?any-version(?installed?depends(?exact-name(packagename)))'
Note that packagename is just the package name, without architecture information. For instance, libpcre3 works, but not libpcre3:amd64.
- 196
With the reverse-depends command from the package: ubuntu-dev-tools
reverse-depends libjs-openlayers
# For build depends search
reverse-depends -b libjs-openlayers
Reverse-Recommends
* gis-osm
Reverse-Depends
- cyclograph
- phpmyadmin
- sumo-tools
Packages without architectures listed are reverse-dependencies in: amd64, arm64, armhf, i386, ppc64el, s390x