How to List Dependencies of a Package in Ubuntu – Guide
Unlike Windows, macOS and Android, software in Ubuntu – and Linux in general – is not distributed as a single package. Instead, when you install an application, your system’s package manager downloads several packages, including the main application package and its dependencies. However, this is only true for installing traditional packages on Linux, ie using package managers. Knowing which additional dependencies are downloaded during an installation can be beneficial for both beginning and advanced users. This way, you have full control over the packages installed on your system. Let’s take a look at How to check a package’s dependencies in Ubuntu.
What are package dependencies?
Dependencies are support packages required for an application to work properly on Linux. For example, if you want to download VLC media player on Ubuntu, APT will install some additional packages like libc6 and gcc, in addition to the main “vlc” package. A dependency can also have other packages as its dependencies, thus forming a hierarchical structure. Since Linux packages are interdependent, almost all software requires additional packages that you must install on your system. Although package managers like APT automate the management and installation of such dependencies, errors do occur when you try to build the package manually from source. However, you can resolve these errors simply by installing the required dependency on your system using the apt install command.
How to Check package dependencies on Linux
Fortunately, in Ubuntu, there are several ways to get a list of a package’s dependencies. APT, the default package manager in Ubuntu and Debian distros, offers several commands to get information related to a package dependency. Using APT Package Manager You can use APT on Ubuntu to get a list of dependencies associated with a package. The basic syntax of the command is: sudo apt depends on package name For example, to check rhythmbox package dependencies: sudo apt depends rhythmbox In addition to the list of dependencies, the output will also include recommended and suggested packages that you can install along with rhythmbox. Alternatively, you can also use the apt-cache command to get the same output. sudo apt-cache depends on rhythmbox For additional information related to a specific package, use the show method instead of Depends. sudo apt show rhythmbox sudo apt-cache show rhythmbox
Listing dependencies using dpkg
If you have downloaded a DEB package on your system and want to know which dependencies will be installed along with the package, you can use the -I (uppercase i, not lowercase L) or -info flag with the command. sudo dpkg -I /path/to/package.deb sudo dpkg –info /path/to/package.deb where /path/to/package.deb is the absolute or relative path to the DEB file. The output will display the package size, font and other useful information along with the list of dependencies. To get the list of dependencies of an installed package, use the -s flag with dpkg. For example: sudo dpkg -s firefox Using apt-rdepends For more verbose output, you can use the apt-rdepends utility. Since it doesn’t come pre-installed on most Linux distributions, you’ll have to manually install it on Ubuntu using APT. sudo apt install apt-rdepends Use the following command format to get a package’s dependency tree: apt-rdepends packagename For example: apt-rdepends vlc The reverse-depends utility Although reverse dependence feature (the -r flag) of apt-rdepends works better than expected, there is yet another utility you can use to extract reverse dependencies from a package. The reverse-depends command is a part of the ubuntu-dev-tools package and can be downloaded using sudo apt install ubuntu-dev-too The default command syntax is reverse-depends packagena options where options are the flags you can use with the command and packagename is the name of the package you want to revert, check the dependencies for You can also add various flags to the mentioned command to modify the output. Here is a list of the most useful options. In case you can’t find out how to use the tool and need command line help, use the –help or -h flag reverse-depends reverse depends -hel Get dependency list using a dummy install / remove For those who want a brief list of all dependencies that are not currently installed on the system, you can perform a mock install (or uninstall) of a specific package To check the dependencies required by the PHP package, for example, run the following command sudo apt install -sp The output will contain a section “The following additional packages will be installed”. All package names listed below are dependencies that were not found in your system.hpd: .lp-h.sss) s: .me: ls: Please share this article if you like it!
Final note
I hope you like the guide How to List Dependencies of a Package in Ubuntu. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.