We know that most of the packages we install on our Linux operating system cannot work properly without other prerequisite packages installed. Such prerequisite packages are called dependencies. Sometimes you want to find out the dependencies of a particular package. So today I will show you three ways to check and list the dependencies of a package in Debian 10 and Ubuntu 20.04.

Checking the Dependencies of a Package in Debian and Ubuntu

For checking the dependencies of a package in Debian 10, you can make use of any of the three methods discussed below:

Method # 1: Using apt show command

For checking the dependencies of a particular package using the apt show command, you will need to follow the steps mentioned below:

Since all the commands that we are going to discuss are passed via terminal, therefore, we will need to launch the terminal in Debian 10. All we have to do is to click on the Activities tab present at the top left corner of our Debian 10 desktop and then write terminal in the displayed search bar. Then just click on the terminal search result to launch it in Debian 10 as shown in the following image:

Linux Terminal

Now type the following command in your terminal and then press the Enter key:

apt show PACKAGE_NAME

Here, replace PACKAGE_NAME with the name of the package whose dependencies you want to find out. In this example, we wanted to check the dependencies of the zlib1g package using the apt show command in Debian 10. Therefore, we have replaced PACKAGE_NAME with zlib1g as shown in the image below:

apt show command

As soon as this command will execute successfully you will be able to see the dependencies of the specified package along with some other information as highlighted in the following image:

Display package dependencies using apt show command

Method # 2: Using apt-cache depends command

For checking the dependencies of a particular package using the apt-cache command in Debian 10, you will need to perform the following steps:

You need to launch the terminal in the same way as explained in the method above. Now type the following command in your terminal and then press the Enter key:

apt-cache depends PACKAGE_NAME

Here, replace PACKAGE_NAME with the name of the package whose dependencies you want to find out. In this example, we wanted to check the dependencies of the zlib1g package using the apt-cache command in Debian 10. Therefore, we have replaced PACKAGE_NAME with zlib1g as shown in the image below:

apt-cache depends command

  • As soon as this command will execute successfully, you will be able to see the dependencies of the specified package as highlighted in the following image:

Show dependencies with apt-cache depends

Method # 3: using apt-rdepends command

For checking the dependencies of a particular package using the apt-rdepends command in Debian 10, you will need to follow the steps mentioned below:

Again, you need to launch the terminal as described in the method above. After successfully launching the terminal, you will need to install the apt-rdepends command on your Debian 10 system as it is not enabled by default. For installing it, type the following command in your terminal and then press the Enter key:

sudo apt install apt-rdepends

Running this command will install the apt-rdepends command on your Debian 10 system. It is shown in the following image:

Install apt-rdepends

  • During the installation of this command, your system will ask you if you want to proceed with this installation or not. You just need to type “Y” and press the Enter key for providing your consent as highlighted in the image shown below:

Confirm package installation

Once the installation of this command will complete, your Debian 10 terminal will look something like this:

apt-rdepends installed successfully

Now type the following command in your terminal and then press the Enter key:

apt-rdepends -r PACKAGE_NAME

Here, replace PACKAGE_NAME with the name of the package whose dependencies you want to find out. In this example, we wanted to check the dependencies of the zlib1g package by using the apt-rdepends command in Debian 10. Therefore, we have replaced PACKAGE_NAME with zlib1g as shown in the image below:

apt-rdepends command

  • This command will take a long time to execute because it is supposed to process all the reverse dependencies. Its output is shown in the following image:

Package dependency list shown by apt-rdepends command

Conclusion

By making use of any of the three methods described in this article, you can easily find the dependencies of any desired package in Debian and Ubuntu. All of these methods are quite simple and easy to follow, however, a point to be noted here for Method # 3 is that you will need to stay very patient while the execution of that command takes place.

Check Dependencies of a Package in Ubuntu 20.04 and Debian 10

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn