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 <Package_name> with the name of a package you want to find the dependencies.
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
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
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
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
In this way you can use the tool to get the information of dependencies of any package you want.
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.