Ubuntu

3 Ways to Check Dependencies of a Package in Ubuntu 22.04

We install different types of packages on Ubuntu and these packages are dependent on some other packages which are required to be pre-installed for new packages to function properly. The packages on which the installation of the new package depends are known as the package dependencies.

In this write-up, we will explore different ways to find out the dependencies of the newly going install package.

How to check dependencies of a package in Ubuntu 22.04

We can check the dependencies by the below-mentioned methods:

  • By using the apt command
  • By using the dpkg command
  • By installing a third-party tool

Method 1: Checking dependencies of a Package in Ubuntu 22.04 by using the apt command

The apt is a default package manager that is used to install, manage, and delete the applications from Ubuntu. The apt package manager can be used to display the dependencies of any package which is to be installed, for example, we want to find out the dependencies of the LibreCAD, we will use the command:

$ sudo apt show librecad

The above command tells us about the information of the package also like the origin and priority, but if you want to display only the package dependencies, then we will use the command:

$ apt-cache depends librecad

The above command displayed the to-the-point results.

Method 2: Checking dependencies of a Package in Ubuntu 22.04 by using the dpkg command

If we want to know the package dependencies of the Debian or deb package, then we will use the dpkg package manager with the “I” flag to find out the package dependencies, for example, we will use the command to find out the details of the package dependencies of the teamviewer deb package:

$ dpkg --info ./teamviewer-host_i386.deb

Method 3: Checking dependencies of a Package in Ubuntu 22.04 by installing a third-party tool

There are a number of third-party packages which are used to find out the dependencies of the different packages, one of these packages is known as the “apt-rdepends” tool. To use the apt-rdepends, we have to first install it by using the apt package manager:

$ sudo apt install apt-rdepends -y

Now we will use the installed package of apt-rdepends to find out the dependencies of the VLC media player using the command:

$ sudo apt-rdepends vlc

Conclusion

Package dependencies are important for the package to function properly. There are various ways to check package dependencies in Ubuntu and in this guide, we have discussed 3 methods to find out all dependencies of any specific package.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.