How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions (2024)

Installing applications via command line is quite easy in Ubuntu/Debian. All you need to do is to use apt install package_name.

But what if you want to know the dependencies of a package before or after installing it?

In this tutorial, I’ll show you various ways to see the dependencies of a package in Ubuntu and other Debian-based Linux distributions that use APT package management system.

What is package dependency in Ubuntu?

If you didn’t know already, when you install a software package in Linux, sometimes, it needs other packages to function properly. These additional packages are called dependencies. If these dependency packages are not installed on the system, it is usually installed automatically with the package.

For example, the GUI tool HandBrake for converting video formats needs FFmpeg, GStreamer. So for HandBrake, FFmpeg and GStreamer are the dependencies.

If you don’t have these packages installed on your system, they will be automatically installed when you install HandBrake on Ubuntu.

Check dependencies of a package in Ubuntu and Debian based distributions

As it often happens in Linux, there are more than one way to achieve the same result. Let’s see various ways to see the dependencies of a package.

Checking dependencies with apt show

You can use the apt show command to display details of a package. Part of this information is dependencies and you can see it in the line starting with Depends.

For example, here’s what it shows for ubuntu-restricted-extras package.

abhishek@itsfoss:~$ apt show ubuntu-restricted-extras Package: ubuntu-restricted-extrasVersion: 67Priority: optionalSection: multiverse/metapackagesOrigin: UbuntuMaintainer: Ubuntu Developers <[emailprotected]>Bugs: https://bugs.launchpad.net/ubuntu/+filebugInstalled-Size: 14.3 kBDepends: ubuntu-restricted-addonsRecommends: libavcodec-extra, ttf-mscorefonts-installer, unrarDownload-Size: 3,200 BAPT-Manual-Installed: yesAPT-Sources: http://us.archive.ubuntu.com/ubuntu focal/multiverse amd64 PackagesDescription: Commonly used media codecs and fonts for Ubuntu This collection of packages includes: - MP3 and other audio codec software to play various audio formats (GStreamer plugins) - software to install the Microsoft Web fonts - the Adobe Flash plugin - LAME, software to create compressed audio files. . This software does not include libdvdcss2, and will not let you play encrypted DVDs. For more information, see https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs . These software packages are from the Multiverse channel, restricted by copyright or legal issues in some countries. For more information, see http://www.ubuntu.com/ubuntu/licensing

As you can see, ubuntu-restricted-extras package depends on ubuntu-restricted-addons package.

Here’s a catch! The dependency package may also depend on some other package and the chain could go on. Thankfully, the APT package manager handles this for you by automatically installing all the dependencies (most of the time).

What is recommended package?

Did you notice the line starting with Recommends in the above output?

Recommended packages are not direct dependencies for the package but they enable additional features.

As you can see, ubuntu-restricted-extras has ttf-mscorefonts-installer as recommended package for installing Microsoft Fonts on Ubuntu.

The recommended packages are also installed by default and if you explicitly want to forbid the installation of recommended package, use the –no-install-recommends flag like this:

sudo apt install –no-install-recommends package_name

Use apt-cache for getting just the dependencies information

The apt show has way too many information. If you want to get the dependencies in a script, the apt-cache command gives you a better and clean output.

apt-cache depends package_name

The output looks much clean, does it not?

How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions (1)

Check the dependencies of a DEB file using dpkg

Both apt and apt-cache command work on the packages that are available from the repositories. But if you download a DEB file, these command won’t work.

In this case, you can use the dpkg command with -I or –info option.

dpkg -I path_to_deb_file

The dependencies can be seen in the line starting with Depends.

How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions (2)

Checking dependencies and reverse dependencies with apt-rdepends

If you want more details on the dependencies, you can use the apt-rdepends tool. This tool creates the complete dependency tree. So, you get the dependency of a package and the dependencies of the dependencies as well.

It is not a regular apt command and you’ll have to install it from the universe repository:

sudo apt install apt-rdepends

The output is usually quite large depending on the dependency tree.

Reading package lists... DoneBuilding dependency tree Reading state information... Doneshutter Depends: procps Depends: xdg-utilsimagemagick Depends: imagemagick-6.q16 (>= 8:6.9.2.10+dfsg-2~)imagemagick-6.q16 Depends: hicolor-icon-theme Depends: libc6 (>= 2.4) Depends: libmagickcore-6.q16-6 (>= 8:6.9.10.2) Depends: libmagickwand-6.q16-6 (>= 8:6.9.10.2)hicolor-icon-themelibc6 Depends: libcrypt1 (>= 1:4.4.10-10ubuntu4) Depends: libgcc-s1libcrypt1 Depends: libc6 (>= 2.25)

The apt-rdepends tool is quite versatile. It can also calculate the reverse dependencies. Which means, you can see what other packages depend on a certain package.

apt-rdepends -r package_name

The output could be pretty big because it will print the reverse dependency tree.

abhishek@itsfoss:~$ apt-rdepends -r ffmpegReading package lists... DoneBuilding dependency tree Reading state information... Doneffmpeg Reverse Depends: ardour-video-timeline (>= 1:5.12.0-3ubuntu4) Reverse Depends: deepin-screen-recorder (5.0.0-1build2) Reverse Depends: devede (4.15.0-2) Reverse Depends: dvd-slideshow (0.8.6.1-1) Reverse Depends: green-recorder (>= 3.2.3)

I hope this quick tutorial was helpful in improving your command line knowledge a bit. Stay tuned for more such tips.

How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions (2024)

FAQs

How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions? ›

Check the dependencies of a DEB file using dpkg

How to check package dependencies in Debian? ›

To check the package dependencies, we will use the dpkg command with the -I flag. You will see various information in your terminal about the package, and the package dependencies are listed under the Depends section as seen in the screenshot below.

How to check dependencies of a package in Ubuntu? ›

Run the following command to find the dependencies of a package: sudo apt show <package-name>. Replace <package-name> with the actual package name.

How do I view package dependencies? ›

Just write npm ls packageName and you'll see a set of files that are dependent on the package. You can also use npm explain packageName to understand why a specific package is needed and if it depends on any other package in your project.

How to check Debian package in Ubuntu? ›

Debian or Ubuntu Linux commands to find out which package owns a file:
  1. Open the terminal application.
  2. Type the following command to find out what package provides /usr/bin/passwd file: $ dpkg -S /usr/bin/passwd.
  3. Use apt-file package searching utility: $ apt-file search vim.
  4. Let us find file belongs package:
Apr 27, 2023

How do I view the contents of a Debian package? ›

Assuming you have the actual debian package, the following command will list its contents:
  1. $ dpkg -c ./path/to/test.deb.
  2. $ ar -x ./test_2. ...
  3. $ tar -xzf control.tar.gz.
  4. control md5sums.
  5. $ tar -xzf data.tar.gz $ ls control control.tar.gz data.tar.gz debian-binary md5sums test_2.

How to check dependencies of a package in Linux using RPM? ›

2.1.

Here, we use -q (–query) option along with the package name. Moreover, -R (–requires) lists what the package depends on.

How do I check my Ubuntu package? ›

Solution: In order to view all installed packages in linux Ubuntu, run on terminal apt --installed list , Use apt flags and would be able to see available upgrades to some packages ( --upgradeable ) / current installed packages ( --installed ) / all available versions ( --all-versions ).

How to run package manager in Ubuntu? ›

This guide shows you how to use apt-get to manage packages on Ubuntu. Since apt-get is a command-line utility, we will need to use the Ubuntu terminal. Select the system menu > Applications > System Tools > Terminal. Alternatively, you can use use the Ctrl + Alt + T keys to open Terminal.

How do I find module dependencies? ›

Go to Code | Analyze Code | Module Dependencies. If there are no selected modules in the Project tool window, you will be prompted to specify the scope of analysis. You can inspect the whole project, the current module, or a module group.

How do I track dependencies? ›

In order to identify project dependencies, you must first create a map of project tasks. Next, look for tasks that the team cannot perform until they receive information or deliverables from a previous task. Those tasks are dependent. Think of your whole project as a series of workflows or a flowchart.

What are package dependencies? ›

Package Dependencies. In projects, a package dependency is a package installed on the development system and used in the project. The Package Dependencies document (. sls) stores a list of packages a project uses so you can set up a development system with the required packages.

How to install all package dependencies? ›

npm install will read the package. json file and download all the specified dependencies. It will create a folder named “node_modules” in your project directory, where it stores all the installed packages. Once the installation process is complete, you can start utilizing the installed dependencies in your code.

How do I find packages in Debian? ›

Search package directories

There are shortcuts for some searches available: https://packages.debian.org/ name for the search on package names. https://packages.debian.org/src: name for the search on source package names.

How to check debian package version in Linux? ›

On a debian system just run dpkg-query -f '${Version}' -W <package> to query the version installed.

How to check if a package is installed in Debian? ›

Using dpkg -query. To begin with, we can use the dpkg-query to check the installation status of a package and whether it's present in our system. In the above script, we verify whether the curl package is installed on a system using the Debian package management system (dpkg).

How do I see all installed packages in Debian? ›

Note: The sudo dpkg -l | grep [package-Name] command lists all packages and then filters the output to show only lines containing package names. Whereas, the sudo dpkg-query -W [package-Name] command shows information about a specific package that is known to the dpkg database, whether it's installed or not.

How do I search for packages in Debian? ›

Search package directories

There are shortcuts for some searches available: https://packages.debian.org/ name for the search on package names. https://packages.debian.org/src: name for the search on source package names.

How to find files installed by package in Debian? ›

On Debian/Ubuntu distributions, you can use the dpkg command with the -L flag to list files installed to your Debian system or its derivatives, from a given . deb package.

How to check library dependencies in Linux? ›

Steps to identify shared library dependency in Linux:
  1. Open your preferred terminal application.
  2. Determine the absolute path of the program you want to inspect. ...
  3. Use ldd to display the shared object dependencies. ...
  4. Use readelf to find the dynamic libraries required by the program.

Top Articles
Drone Pilot Jobs Guide: Exploring Opportunities for UAS Jobs
Elon Musk wants Tesla to invest $5 billion into his newest startup, xAI — if shareholders approve
Knoxville Tennessee White Pages
Is Sam's Club Plus worth it? What to know about the premium warehouse membership before you sign up
Cold Air Intake - High-flow, Roto-mold Tube - TOYOTA TACOMA V6-4.0
Wizard Build Season 28
Readyset Ochsner.org
Apex Rank Leaderboard
Elden Ring Dex/Int Build
Atrium Shift Select
Skip The Games Norfolk Virginia
Oppenheimer & Co. Inc. Buys Shares of 798,472 AST SpaceMobile, Inc. (NASDAQ:ASTS)
Elizabethtown Mesothelioma Legal Question
Missing 2023 Showtimes Near Landmark Cinemas Peoria
Sony E 18-200mm F3.5-6.3 OSS LE Review
Gino Jennings Live Stream Today
Munich residents spend the most online for food
Tamilrockers Movies 2023 Download
Katherine Croan Ewald
Diamond Piers Menards
The Ultimate Style Guide To Casual Dress Code For Women
Site : Storagealamogordo.com Easy Call
Is Windbound Multiplayer
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Integer Division Matlab
Sandals Travel Agent Login
Horn Rank
Ltg Speech Copy Paste
Random Bibleizer
Craigslist Fort Smith Ar Personals
The Clapping Song Lyrics by Belle Stars
Poe T4 Aisling
R/Sandiego
Kempsville Recreation Center Pool Schedule
Rogold Extension
Beaver Saddle Ark
Log in or sign up to view
A Man Called Otto Showtimes Near Amc Muncie 12
Powerspec G512
Saybyebugs At Walmart
2007 Jaguar XK Low Miles for sale - Palm Desert, CA - craigslist
Miami Vice turns 40: A look back at the iconic series
Love Words Starting with P (With Definition)
Tlc Africa Deaths 2021
Youravon Com Mi Cuenta
Nope 123Movies Full
Kushfly Promo Code
Diario Las Americas Rentas Hialeah
Game Akin To Bingo Nyt
Marion City Wide Garage Sale 2023
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated:

Views: 6430

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.