« Back to Package manager: Frequently Asked Questions

How to see the dependencies of a package with apt?

How to see the dependencies of a package with apt?

Run apt with the 'show' subcommand followed by the package to see basic details about a package, including its dependencies. For a package that is not installed yet, use the 'install' subcommand to see related packages.

apt show PACKAGE

Run apt command with the show subcommand to see basic information about the package. This includes version information, but also any dependencies, recommendations, or even conflicting packages.

# apt show systemd                                                                                          
Package: systemd
Version: 252.30-1~deb12u2
Priority: important
Section: admin
Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
Installed-Size: 9895 kB
Provides: systemd-sysusers (= 252.30-1~deb12u2), systemd-tmpfiles (= 252.30-1~deb12u2)
Pre-Depends: libblkid1 (>= 2.24), libc6 (>= 2.34), libcap2 (>= 1:2.10), libgcrypt20 (>= 1.10.0), liblz4-1 (>= 0.0~r122), liblzma5 (>= 5.1.1alpha+20120614), libmount1 (>= 2.30), libselinux1 (>= 3.1~), libssl3 (>= 3.0.0), libzstd1 (>= 1.5.2)
Depends: libacl1 (>= 2.2.23), libaudit1 (>= 1:2.2.1), libblkid1 (>= 2.24.2), libcryptsetup12 (>= 2:2.4), libfdisk1 (>= 2.33), libkmod2 (>= 15), libp11-kit0 (>= 0.23.18.1), libseccomp2 (>= 2.3.1), libsystemd-shared (= 252.30-1~deb12u2), libsystemd0 (= 252.30-1~deb12u2), mount
Recommends: default-dbus-system-bus | dbus-system-bus, systemd-timesyncd | time-daemon
Suggests: systemd-container, systemd-homed, systemd-userdbd, systemd-boot, systemd-resolved, libfido2-1, libqrencode4, libtss2-esys-3.0.2-0, libtss2-mu0, libtss2-rc0, polkitd | policykit-1
Conflicts: consolekit, libpam-ck-connector, systemd-shim
Breaks: less (<< 563), resolvconf (<< 1.83~), sicherboot (<< 0.1.6), udev (<< 247~)
Homepage: https://www.freedesktop.org/wiki/Software/systemd
Tag: admin::boot, implemented-in::c, interface::daemon, role::program,
 works-with::software:running
Download-Size: 3035 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian bookworm/main amd64 Packages
Description: system and service manager
 systemd is a system and service manager for Linux. It provides aggressive
 parallelization capabilities, uses socket and D-Bus activation for starting
 services, offers on-demand starting of daemons, keeps track of processes using
 Linux control groups, maintains mount and automount points and implements an
 elaborate transactional dependency-based service control logic.
 .
 Installing the systemd package will not switch your init system unless you
 boot with init=/lib/systemd/systemd or install systemd-sysv in addition.

To see the dependencies of a package that is not installed yet, use the install subcommand. It will show any additional packages that will be installed, which are the required dependencies of the selected package.

# apt install nginx                                                                                    
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  nginx-common
Suggested packages:
  fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  nginx nginx-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 640 kB of archives.
After this operation, 1696 kB of additional disk space will be used.
Do you want to continue? [Y/n]

Learn more about apt

This article uses the apt command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: apt

apt cheat sheet

Other questions related to Package manager

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon