Package Managers Compared: apt, dnf, pacman, zypper
What is a package manager?
Conclusion: A package manager installs, updates, removes, and resolves dependencies for software. Distros name it differently —
apt,dnf,pacman,zypper— but the job is the same.
On Linux you do not hunt down individual installers like on Windows. A package manager pulls the target package from a central repository and automatically resolves its dependencies (the other libraries it needs).
The goal of this guide is to put the four major package managers on one map. The command names differ, but the pattern of operations is shared: refresh the index, install, search, remove. Learn the pattern and you will not get lost on a distro you have never touched.
Who this is for
- Intermediate users who work across multiple distros
- People comfortable with
aptbut stuck ondnforpacman - Anyone hitting distro differences in a Dockerfile or server migration
Why does each distribution differ?
Conclusion: The package format (
.deb,.rpm, etc.) and the design philosophy that manages it differ by distro family. The major families are Debian, Red Hat, Arch, and SUSE.
Historically each distro evolved its own package management. As a result, the format and the tools split along family lines.
| Family | Representative distros | Format | High-level tool | Low-level tool |
|---|---|---|---|---|
| Debian | Debian / Ubuntu | .deb |
apt |
dpkg |
| Red Hat | Fedora / RHEL / Rocky | .rpm |
dnf |
rpm |
| Arch | Arch / Manjaro | .pkg.tar.zst |
pacman |
pacman |
| SUSE | openSUSE / SLE | .rpm |
zypper |
rpm |
The "high-level tool" handles repository fetching and dependency resolution; the "low-level tool" unpacks and registers a single package file. You mostly touch the high-level side, but the relationship is covered below.
The apt map (Debian / Ubuntu family)
Conclusion:
aptis the most widely used high-level tool. The basic pattern issudo apt updateto refresh the index, thensudo apt install <package>.
Used on Debian, Ubuntu, and their derivatives. apt is the interactive front end that unifies the older apt-get / apt-cache.
# Refresh the index (package list) $ sudo apt update # Upgrade all installed packages $ sudo apt upgrade # Install a package $ sudo apt install nginx # Remove (keep config files) $ sudo apt remove nginx # Remove including config files $ sudo apt purge nginx # Search / show info $ apt search keyword $ apt show nginx
apt update (refresh the index) and apt upgrade (upgrade packages) are different things. update alone changes nothing on disk. Always run update before a fresh install.
The dnf map (Fedora / RHEL family)
Conclusion:
dnfis the standard tool of the Red Hat family and the successor toyum. Unlikeapt, it refreshes metadata automatically when you run a command.
Used on Fedora, RHEL 8+, Rocky Linux, and AlmaLinux. The yum command usually remains as an alias to dnf.
# Upgrade the whole system (metadata fetch is automatic) $ sudo dnf upgrade # Only check what can be updated $ dnf check-update # Install a package $ sudo dnf install nginx # Remove $ sudo dnf remove nginx # Search / show info $ dnf search keyword $ dnf info nginx
No explicit index-refresh command like apt needs. When you run dnf install / dnf upgrade, stale metadata is refreshed automatically.
The pacman map (Arch family)
Conclusion:
pacmanis driven by short option letters. The building blocks are-S(sync = install),-R(remove),-Q(query),-y(refresh DB), and-u(upgrade).
Used on Arch Linux and Manjaro. Fastest once it clicks, but the symbolic options confuse newcomers at first.
# Sync the package DB and fully upgrade the system (most common) $ sudo pacman -Syu # Install a package $ sudo pacman -S nginx # Remove (also drop now-unneeded dependencies) $ sudo pacman -Rs nginx # Search (remote) / show info (remote) $ pacman -Ss keyword $ pacman -Si nginx # List installed packages $ pacman -Q
Arch is rolling release. Partial upgrades are discouraged: even before installing a single package, sync the whole system with pacman -Syu. Breaking consistency makes the system easy to corrupt.
The zypper map (openSUSE family)
Conclusion:
zypperis the standard tool of openSUSE / SLE. Its flow —refresh(update index), theninstall/update— is close toapt. Each subcommand has a short form.
Used on openSUSE Leap / Tumbleweed and SUSE Linux Enterprise. The format is .rpm, but the tool is a different lineage from dnf.
# Refresh the repository index $ sudo zypper refresh # Update installed packages $ sudo zypper update # Install a package (short form: in) $ sudo zypper install nginx # Remove (short form: rm) $ sudo zypper remove nginx # Search (short form: se) / show info $ zypper search keyword $ zypper info nginx
On the rolling-release Tumbleweed, upgrade the whole system with sudo zypper dup (distribution upgrade) rather than a plain update. On Leap (fixed release), update is fine.
The four-command comparison table
Conclusion: Line the tools up by operation (update, install, remove, search) and you can work on any unknown distro just by reading the table. This is the map at the heart of this guide.
| Task | apt | dnf | pacman | zypper |
|---|---|---|---|---|
| Refresh index | apt update |
(automatic) | pacman -Sy |
zypper refresh |
| Upgrade whole system | apt upgrade |
dnf upgrade |
pacman -Syu |
zypper update |
| Install a package | apt install <pkg> |
dnf install <pkg> |
pacman -S <pkg> |
zypper install <pkg> |
| Remove a package | apt remove <pkg> |
dnf remove <pkg> |
pacman -R <pkg> |
zypper remove <pkg> |
| Search | apt search <word> |
dnf search <word> |
pacman -Ss <word> |
zypper search <word> |
| Show info | apt show <pkg> |
dnf info <pkg> |
pacman -Si <pkg> |
zypper info <pkg> |
| List installed | apt list --installed |
dnf list --installed |
pacman -Q |
zypper search -i |
How to remember: put the four actions — update, install, remove, search — on the vertical axis and the distros on the horizontal axis. When you land in a new environment, just read one column of this table.
How do dpkg / rpm relate to all this?
Conclusion:
dpkg/rpmare low-level tools that operate directly on a single package file. They do not resolve dependencies, so use a high-level tool (apt/dnf, etc.) when you want dependencies handled automatically.
Use a low-level tool when you want to install a downloaded .deb / .rpm directly.
# Install a .deb directly (does not resolve dependencies) $ sudo dpkg -i package.deb # Install a .rpm directly (does not resolve dependencies) $ sudo rpm -i package.rpm
Because low-level tools skip dependency resolution, dpkg -i can leave you with missing dependencies. Fix them with sudo apt install -f. Going through the high-level tool is the safe default.
How do you choose and migrate?
Conclusion: You do not really "choose" — the distro decides for you. When migrating, translate commands via the table, and additionally watch out for partial upgrades on rolling distros (Arch / Tumbleweed).
The practical decision points:
- Server operations: Ubuntu (
apt) and the RHEL family (dnf) dominate. If you write Dockerfiles, learn theinstallsyntax for both. - Desktop / cutting edge: Arch (
pacman) or Fedora (dnf). Get used to thepacman -Syudiscipline. - Enterprise: the SUSE family (
zypper). Mind the difference betweenzypper dupandupdate. - When migrating: commands map 1:1 via the comparison table. The two things that trip people up are "is the index refresh automatic or manual" and "rolling or fixed release".
First step: identify your distro family (the table in why each differs) and memorize only that column of commands. Look up the other families in the comparison table when you actually need them.