List Dependencies of a Package in Ubuntu

#Introduction

In this tutorial, How to check the dependencies of the package in Ubuntu.

How to Check Package Dependencies in Ubuntu

The default package manager in Ubuntu and Debian-based distros is APT. There are several ways to get the list of Dependencies of a Package in Ubuntu

APT Package Manager

The basic syntax of the command

sudo apt depends package_name

For example, How to check dependencies for the Nginx package

sudo apt depends nginx

The output terminal is as below

Dependencies of a Package in Ubuntu

Alternatively, You can use apt-cache command

To list the dependencies of a package in Ubuntu, you can use the apt-cache command. The apt-cache command provides information about packages available in the repositories.

Please note that you may need administrative privileges (e.g., using sudo) to execute apt-cache commands.

Here’s how you can list the dependencies of a package:

sudo apt-cache depends nginx

The output terminal is as below

Dependencies of a Package in Ubuntu

To get additional information on a specific package

sudo apt show nginx
sudo apt-cache show nginx

Using dpkg

If you have downloaded a DEB package on your system and want to know which dependencies will be installed along with the package

sudo dpkg -I /home/vagrant/package.deb
sudo dpkg --info /home/vagrant/package.deb

List Dependencies with command other

apt-rdepends command
reverse-depends command

Get Dependency for Installation and Removal Package

To check the dependencies required by the Nginx

sudo apt install -s nginx

The output terminal is as below

vagrant@devopsroles:~$ sudo apt install -s nginx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8
  libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail
  libnginx-mod-stream libnginx-mod-stream-geoip2 libtiff5 libwebp6 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
  libxpm4 nginx-common nginx-core
Suggested packages:
  libgd-tools fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8
  libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail
  libnginx-mod-stream libnginx-mod-stream-geoip2 libtiff5 libwebp6 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
  libxpm4 nginx nginx-common nginx-core
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Inst libxau6 (1:1.0.9-1build3 Ubuntu:21.04/hirsute [amd64])
Inst libxdmcp6 (1:1.1.3-0ubuntu3 Ubuntu:21.04/hirsute [amd64])
Inst libxcb1 (1.14-3ubuntu1 Ubuntu:21.04/hirsute [amd64])
Inst libx11-data (2:1.7.0-2ubuntu0.1 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [all])
Inst libx11-6 (2:1.7.0-2ubuntu0.1 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst fonts-dejavu-core (2.37-2build1 Ubuntu:21.04/hirsute [all])
Inst fontconfig-config (2.13.1-4.2ubuntu3 Ubuntu:21.04/hirsute [all])
Inst libdeflate0 (1.7-1ubuntu1 Ubuntu:21.04/hirsute [amd64])
Inst libfontconfig1 (2.13.1-4.2ubuntu3 Ubuntu:21.04/hirsute [amd64])
Inst libjpeg-turbo8 (2.0.6-0ubuntu2 Ubuntu:21.04/hirsute [amd64])
Inst libjpeg8 (8c-2ubuntu8 Ubuntu:21.04/hirsute [amd64])
Inst libjbig0 (2.1-3.1build1 Ubuntu:21.04/hirsute [amd64])
Inst libwebp6 (0.6.1-2ubuntu0.21.04.1 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst libtiff5 (4.2.0-1build1 Ubuntu:21.04/hirsute [amd64])
Inst libxpm4 (1:3.5.12-1 Ubuntu:21.04/hirsute [amd64])
Inst libgd3 (2.3.0-2 Ubuntu:21.04/hirsute [amd64])
Inst nginx-common (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [all])
Inst libnginx-mod-http-geoip2 (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst libnginx-mod-http-image-filter (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst libnginx-mod-http-xslt-filter (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst libnginx-mod-mail (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst libnginx-mod-stream (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst libnginx-mod-stream-geoip2 (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst nginx-core (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Inst nginx (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libxau6 (1:1.0.9-1build3 Ubuntu:21.04/hirsute [amd64])
Conf libxdmcp6 (1:1.1.3-0ubuntu3 Ubuntu:21.04/hirsute [amd64])
Conf libxcb1 (1.14-3ubuntu1 Ubuntu:21.04/hirsute [amd64])
Conf libx11-data (2:1.7.0-2ubuntu0.1 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [all])
Conf libx11-6 (2:1.7.0-2ubuntu0.1 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf fonts-dejavu-core (2.37-2build1 Ubuntu:21.04/hirsute [all])
Conf fontconfig-config (2.13.1-4.2ubuntu3 Ubuntu:21.04/hirsute [all])
Conf libdeflate0 (1.7-1ubuntu1 Ubuntu:21.04/hirsute [amd64])
Conf libfontconfig1 (2.13.1-4.2ubuntu3 Ubuntu:21.04/hirsute [amd64])
Conf libjpeg-turbo8 (2.0.6-0ubuntu2 Ubuntu:21.04/hirsute [amd64])
Conf libjpeg8 (8c-2ubuntu8 Ubuntu:21.04/hirsute [amd64])
Conf libjbig0 (2.1-3.1build1 Ubuntu:21.04/hirsute [amd64])
Conf libwebp6 (0.6.1-2ubuntu0.21.04.1 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libtiff5 (4.2.0-1build1 Ubuntu:21.04/hirsute [amd64])
Conf libxpm4 (1:3.5.12-1 Ubuntu:21.04/hirsute [amd64])
Conf libgd3 (2.3.0-2 Ubuntu:21.04/hirsute [amd64])
Conf nginx-common (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [all])
Conf libnginx-mod-http-geoip2 (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libnginx-mod-http-image-filter (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libnginx-mod-http-xslt-filter (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libnginx-mod-mail (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libnginx-mod-stream (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf libnginx-mod-stream-geoip2 (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf nginx-core (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])
Conf nginx (1.18.0-6ubuntu8.2 Ubuntu:21.04/hirsute-updates, Ubuntu:21.04/hirsute-security [amd64])

To check which additional packages will be removed with it.

sudo apt remove -s nginx

The output terminal is as below

Dependencies of a Package in Ubuntu

Conclusion

You have a List of Dependencies of a Package in Ubuntu. I hope will this your helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.