Guides 11792 Published by

The article walks through several ways to list RPM dependencies with DNF, helping administrators check what a package needs before they install or update it on Fedora, CentOS, or other RHEL‑based distributions. It starts by showing how to query an already installed package with the combination of rpm ‑q and dnf repoquery — requires, then expands that technique to preview dependencies for any candidate package using --resolve to reveal the full dependency chain. For situations where no repository access is available or a local .rpm file has been downloaded, the text demonstrates how to use rpm ‑qpR to read the package’s metadata directly and dnf provides to find which packages supply a particular file or capability. Finally, quick tips such as filtering results with grep, using --quiet for concise output, and checking enabled repositories when unexpected dependencies appear give readers practical ways to keep their system lean while managing RPMs.



How to List RPM Package Dependencies with DNF

If you’re juggling packages on Fedora, CentOS, or any RHEL‑based distro, you probably want a quick way to see what a package pulls in before you hit Install. Below are the simplest commands that let you list RPM dependencies with DNF and keep your system lean.

1. View Dependencies of an Already Installed Package
dnf repoquery --requires $(rpm -q <package-name>)

rpm -q grabs the exact package name as recorded in your rpm database (including its version and release). dnf repoquery --requires then looks up that package’s metadata from all enabled repos, giving you a snapshot of what that installed binary actually needs to run.

I once checked my system after a kernel upgrade on Fedora 38; the new driver bundle silently added dozens of libraries I never noticed until I ran this command and saw libdrm, libX11, and even libpciaccess pop up.

2. Peek at Dependencies Before You Install Anything
dnf repoquery --requires <package-name>

Add --resolve if you want to see the full dependency chain, not just the top‑level requirements:

dnf repoquery --requires --resolve <package-name>

Without --resolve, you get the immediate requirements. With it, DNF expands each requirement recursively, showing you every library that will be pulled in transitively—perfect for spotting a heavyweight dependency like libX11 before installing a lightweight CLI tool.

3. Check a Local .rpm File (No Repo Needed)

If you have a downloaded package and want to know what it will bring in before installing, use RPM directly:

rpm -qpR <file.rpm>

This command reads the package’s own metadata; no network traffic, no repo lookups. It tells you exactly which packages need to exist for that file to install cleanly.

4. See Which Packages Provide a Specific File or Capability

Sometimes you want to know what satisfies a particular requirement rather than just listing it:

dnf provides '*/libexample.so'

The provides query shows all packages that contain the file or capability, which is handy if you’re troubleshooting missing dependencies after an upgrade.

Quick Tips
  • Filter with grep to find a keyword in the list:
  dnf repoquery --requires <pkg> | grep -i 'libssl'
  • Combine with --quiet for a terse output when you only care about package names:
  dnf repoquery --requires --quiet <pkg>
  • When you see a dependency that looks out of place, double‑check your enabled repos—sometimes an older mirror will suggest outdated packages.

That’s all you need to keep a close eye on what every RPM pulls in. Happy hunting for those hidden dependencies!