Table of Contents

Ubuntu - Packages - Find Package Dependencies

Issue the command:

aptitude search ~Dpackage_name

Script

This is a script that will recursively show dependencies of packages:

#!/bin/bash
#
# Recursively show dependencies of packages.
 
pkgdep() {
  apt-cache depends --installed $1 | awk -F\: '{print $2}' | grep -v -e '<' -e '>' | awk 'NF'
}
 
for i in $(pkgdep $1); do
  pkgdep $i
done | sort -u

Save and chmod +x. Execute with one package as parameter.

If you also want non-installed packages shown, remove the --installed parameter.


Example

For the package bash:

dep.sh bash
  bash
  debconf
  debianutils
  dpkg
  initscripts
  libc6
  libc-bin
  libgcc1
  libncurses5
  locales
  multiarch-support
  sensible-utils
  tzdata