Interview Q&A / Linux & Shell

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What is the difference between dpkg or rpm and apt or dnf?

SHORT ANSWER

dpkg (Debian) and rpm (Red Hat) install, remove and inspect single package files, but do not fetch dependencies. apt and dnf sit on top: they download from repositories and resolve dependencies automatically, calling dpkg or rpm to do the actual installation.

Explain it simply

A package is like a flat-pack furniture box. dpkg and rpm are the screwdrivers that assemble one box you hand them. apt and dnf are the delivery service: they know the shops, find the box and every other box it needs, and then call the screwdriver.

Low-level: sudo dpkg -i app.deb installs a file you downloaded. If dependencies are missing it stops with an error, and you fix it with sudo apt -f install. On Red Hat: sudo rpm -ivh app.rpm.

High-level: sudo apt install app or sudo dnf install app searches repositories, downloads, resolves dependencies, verifies signatures and installs.

Low-level query commands are still useful: dpkg -l and rpm -qa list installed packages, dpkg -L pkg lists a package's files, and dpkg -S /path or rpm -qf /path tells which package owns a file.

Rule: prefer the high-level tool so dependencies and updates are tracked.

Example

bash
sudo dpkg -i google-chrome.deb       # may fail on missing dependencies
sudo apt -f install                  # pulls the missing ones
sudo apt install ./google-chrome.deb # simpler: apt handles local files too

What to say in the interview

"dpkg and rpm handle single package files without dependency resolution; apt and dnf fetch from repositories and resolve dependencies, using the low-level tool underneath. I use apt install ./file.deb for local packages so dependencies are handled."

Common mistakes

  • Installing a .deb with dpkg -i and ignoring the missing dependency errors.

#linux#package-managers#dpkg#rpm

Related questions

Practise more Linux & Shell questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Linux & Shell quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.