Categories: DebianLinuxShell

Check Dependencies of a Package in Ubuntu and Debian

We know that most of the packages we install on our Linux operating system cannot work correctly 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 11 and Ubuntu 22.04. The same command should work in older Debian and Ubuntu versions as well. If you have to find an installed package, look at this guide first.

Checking the Dependencies of a Package in Debian and Ubuntu

For checking the dependencies of a package in Debian 11, 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 we will discuss are passed via the terminal, we will need to launch the terminal in Debian 11. All we have to do is click on the Activities tab at the top left corner of our Debian 11 desktop and then write terminal in the displayed search bar. Then click on the terminal search result to launch it in Debian 11, as shown in the following image:

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

apt show PACKAGE_NAME

Here, replace PACKAGE_NAME with the package name 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:

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

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 package name 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:

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

Method # 3: using apt-rdepends command

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

Again, it would be best if you launched the terminal described in the method above. After successfully launching the terminal, you will need to install the apt-rdepends command on your Debian 11 system, as it is not enabled by default. To install 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 11 system. It is shown in the following image:

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

Once the installation of this command completes, your Debian 11 terminal will look something like this:

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 package name 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 11. Therefore, we have replaced PACKAGE_NAME with zlib1g, as shown in the image below:

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:

Conclusion

Using 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 pretty 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.

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

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago