Linux · Systems fluency

How do apt and yum or dnf differ?

MediumaptdnfpackagingUpdated Oct 2026
Quiz this track

Short answer

apt is the high-level tool for Debian-based systems using .deb packages and dpkg, while yum has largely been replaced by dnf on RPM-based systems using .rpm packages. The concepts are similar but the commands and metadata differ.

Both solve dependency resolution and repository management, but they come from different packaging families. Debian systems use apt, dpkg, and .deb archives. Red Hat-family systems use dnf, rpm, and .rpm packages, with yum retained as a compatibility command on many releases.

sh
apt install nginx
dnf install nginx
apt-cache policy nginx
dnf info nginx

Concept mapping

  • apt update maps to dnf check-update or dnf makecache
  • apt upgrade maps to dnf upgrade
  • apt remove maps to dnf remove
  • apt search maps to dnf search
  • dpkg -l maps to rpm -qa for installed package lists

dnf tracks transactions and can undo a recent transaction, which is useful for a bad upgrade. apt keeps history under /var/log/apt but rollback is less turnkey. Configuration paths, service names, and default users also differ between distributions.

Do not assume a command from one family exists on the other. Check the distribution before writing automation, and use the native package manager rather than a compatibility wrapper.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1Which package format does apt use?
  2. 2Is yum still used on modern systems?
  3. 3How would you list installed packages on each family?
  4. 4Why can the same service have different names across distributions?

Say it in the interview

apt belongs to the Debian family and works with .deb packages through dpkg. dnf belongs to the RPM family and has largely replaced yum. The workflows map closely: update metadata, install, upgrade, remove, and query. I would not assume identical commands or service names across distributions, so automation should target the native tool.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Linux mock interview and get scored feedback on depth, clarity and confidence.