List package dependencies in Ubuntu

Published: November 09, 2022

List package dependencies in Ubuntu

In this article, we cover how to list package dependencies in Ubuntu. When we install or remove a package the system prompts that certain packages are dependent on the package we are about to install. So, we would have to install those dependent packages as well. Or, additional packages were installed and are no longer required in case we choose to remove the package.

Although there are numerous tools available which can help us get dependency related data. And, one such tool we cover is apt-rdepends. It basically helps us get the required information through apt-cache.

Note: Following operations require superuser privileges. In case you don't have one then we advise you to contact your System Administrator for assistance.

Install apt-rdepends in Ubuntu

The package is available through standard Ubuntu repository. Therefore, update the repository first -

sudo apt update

Next, to install apt-rdepends package -

sudo apt install apt-rdepends

List package dependencies in Ubuntu

Use the following syntax to list package dependencies -

apt-rdepends <package-name>

For instance, if we want to list dependencies for the package - featherpad then,

apt-rdepends featherpad

If the output doesn't fit in the terminal then, use more command-line utility along-with it.

apt-rdepends <package-name> | more

But what if, we want to know about all packages which depends on a package i.e. package we search about is itself a dependency and we want to know about packages to which the dependency caters to. This can be done through -r option.

apt-rdepends -r <package-name>

Continuing with the above example, to list the packages which depends on the package featherpad -

apt-rdepends -r featherpad

Notice the change in output. It shows Reverse Depends instead of Depends. Again, if the output doesn't fit in the terminal then use more command-line utility -

apt-rdepends -r <package-name> | more

In conclusion, we have covered how to list package dependencies in Ubuntu through apt-rdepends command-line tool.