In Linux operating systems, especially for Ubuntu users, the package installation from the apt command is very popular because it’s pretty straightforward and doesn’t require any complex installation method. The command will install the package with the required dependencies most of the time. However, in some cases, you may encounter package dependencies error which may be a hectic task for some people to find out the dependencies information needed to install a package.

This article is a detailed guideline on checking the dependencies of a package in Ubuntu 22.04.

How to Check Dependencies of a Package in Ubuntu 22.04

There are several ways to check dependencies of a package are as followings:

  • Using Apt command
  • Using dpkg command
  • Using Third-party tool

Let’s discuss each method in detail so that you may be able to pick one for checking dependencies information.

1: Check Dependencies using Apt

There are two methods to check the dependencies from apt package command which are given below.

  • Through Apt show
  • Through Apt cache

I: Check Dependencies using apt show

The apt show command uses the apt package management system to get the information of required dependencies needed to install a package through the apt command. If you want to check the package dependencies, you can use the following syntax.

$ apt show <Package_name>

In the above command, replace the with the name of a package you want to find the dependencies.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Check-Dependencies-1.png" data-lazy- height="525" src="data:image/svg xml,” width=”735″>

From the above image, we check the dependencies of the Thunderbird package through the apt show command. You can use the package name on your own.

II: Check Dependencies using apt cache

To check the dependencies using apt cache, you will need to execute the following command in Ubuntu terminal.

$ apt-cache depends <Package_name>

For an example, take the Thunderbird package to check the dependencies through the below given command.

$ apt-cache depends thunderbird

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Check-Dependencies-2.png" data-lazy- height="525" src="data:image/svg xml,” width=”733″>

The above command produces an output with various dependencies information needed for Thunderbird.

2: Check Dependencies using dpkg

The above method is helpful for the packages installed from apt commands. However, for checking the dependencies of the deb package, you will need to use the following command.

$ dpkg –info <path_of_deb_file>

Let suppose, we have a deb file of Hyper Terminal (a terminal used for Linux system). To get the dependencies details of this deb file use the following command.

$ dpkg –info hyper_3.2.3_amd64.deb

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Check-Dependencies-3.png" data-lazy- height="529" src="data:image/svg xml,” width=”719″>

The above command will provide you the dependencies information of the Hyper Terminal deb package.

3: Check Dependencies using Third-party tool

In case, if you want to use a third-party tool to check the dependencies of a package in Ubuntu, apt-rdepends is a perfect option. This is an authentic tool that will easily provide you the dependencies information of a package. To install this tool, use the below-given command.

$ sudo apt install apt-rdepends

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Check-Dependencies-4.png" data-lazy- height="524" src="data:image/svg xml,” width=”718″>

After completing the installation, you can use the following syntax to check the package dependencies.

$ apt-rdepends <Package_name>

As an example, let’s suppose we want to check the dependencies information of Thunderbird through this tool then we can use the following command-line to get the information.

$ apt-rdepends thunderbird

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Check-Dependencies-5.png" data-lazy- height="524" src="data:image/svg xml,” width=”717″>

In this way you can use the tool to get the information of dependencies of any package you want.

Conclusion

Installing packages on the Ubuntu is a straightforward task on the command-line terminal. These packages require some dependencies that need to be installed with the package. Several methods are discussed above to check package dependencies. You can use the apt command or use dpkg to get the dependencies information of a dpkg file. You can also use the apt-rdepends tool as well for this purpose.

About the author

<img data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/unnamesadadsasdd-150×150.jpg628ef9fb0137a.jpg" height="112" src="data:image/svg xml,” width=”112″>

Awais Khan

I’m an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.