Linux Package Managers: apt, dnf, pacman and zypper Compared

Tested on: Ubuntu 26.04 LTS · Debian 12 · Fedora 44 · Arch Linux · openSUSE Leap 15.6 — Last updated: June 2026
Every Linux distribution ships with a package manager — the tool responsible for installing, upgrading, and removing software. Unlike Windows installers or macOS DMGs, Linux package managers pull cryptographically signed packages from curated central repositories, handle dependency resolution automatically, and keep every piece of software on your system updatable with a single command. The four dominant package managers — apt, dnf, pacman, and zypper — cover roughly 95% of Linux installations. This guide maps their equivalent commands, explains where they differ in philosophy, and covers universal packaging formats (Flatpak, Snap, AppImage) for when native repos fall short.
Prerequisites
- A running Linux system on one of the supported distros listed above
- A user account with
sudoprivileges (or root access) - Basic terminal familiarity — you know how to open a shell and run commands
- An active internet connection for downloading packages
Package Manager Overview
Each package manager belongs to a distro family and uses a specific binary package format:
| Package Manager | Distros | Package Format | Repository Backend |
|---|---|---|---|
| apt (Advanced Package Tool) | Ubuntu, Debian, Mint, Pop!_OS, Kali | .deb | APT repositories + PPAs |
| dnf (Dandified YUM) | Fedora, RHEL 8+, CentOS Stream, Rocky, AlmaLinux | .rpm | DNF/YUM repos + COPR |
| pacman | Arch Linux, Manjaro, EndeavourOS, Garuda | .pkg.tar.zst | Official repos + AUR |
| zypper | openSUSE Leap, Tumbleweed, SUSE Linux Enterprise | .rpm | OBS repositories |
Both dnf and zypper use RPM packages, but they are not interchangeable — their repositories, dependency databases, and tooling are entirely separate ecosystems. A Fedora RPM will not install cleanly on openSUSE and vice versa.
apt — Debian and Ubuntu
apt is the high-level frontend for Debian's package system. Under the hood, apt calls dpkg for actual package manipulation and handles dependency resolution, repository communication, and authentication itself. On Ubuntu 26.04 and Debian 12, apt is all you need for day-to-day work; drop to dpkg only when working with locally downloaded .deb files.
Core apt Commands
# Sync the local package index with remote repositories — run this before installing anything
sudo apt update
# Upgrade all installed packages (safe — won't remove packages or change dependencies)
sudo apt upgrade
# Full upgrade — handles dependency changes, may remove obsolete packages
sudo apt full-upgrade
# Install a single package
sudo apt install htop
# Install multiple packages in one shot
sudo apt install htop curl wget git build-essential
# Remove a package (leave config files)
sudo apt remove packagename
# Remove package AND its configuration files
sudo apt purge packagename
# Remove packages that were auto-installed as dependencies and are no longer needed
sudo apt autoremove
# Search for a package by name or description
apt search keyword
# Show detailed package metadata — version, dependencies, homepage
apt show htop
# List all installed packages
apt list --installed
# List files installed by a package
dpkg -L htop
# Find which package owns a specific file on disk
dpkg -S /usr/bin/htop
# Find which package provides a file that isn't installed yet
# (requires: sudo apt install apt-file && sudo apt-file update)
apt-file search filenameExample output from apt show htop:
Package: htop
Version: 3.3.0-4
Priority: optional
Section: utils
Depends: libc6, libncursesw6, libnl-3-200, libnl-genl-3-200, libsensors5
Homepage: https://htop.dev
Download-Size: 158 kB
APT-Sources: http://archive.ubuntu.com/ubuntu noble/main amd64 PackagesAdding Repositories and PPAs
# Add a PPA (Personal Package Archive) — Ubuntu-specific
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
# Add a third-party repository manually with a signed key
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
| sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main"
| sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt update
sudo apt install nodejs
# Install a local .deb file (dpkg handles the file; apt fixes any missing dependencies)
sudo dpkg -i package.deb
sudo apt install -f # fix broken dependencies if dpkg errors outdnf — Fedora and RHEL
dnf replaced yum as the default on Fedora 22 and RHEL 8. It's faster, has better dependency resolution, and supports modules (version streams for languages and runtimes). On RHEL and its derivatives (Rocky, AlmaLinux), you'll also interact with subscription-manager for entitlement-based repos, but dnf syntax is identical.
Core dnf Commands
# Check which packages have updates available (doesn't apply them)
sudo dnf check-update
# Apply all available updates
sudo dnf upgrade
# Install a package
sudo dnf install htop
# Install a package group (e.g., development tools)
sudo dnf groupinstall "Development Tools"
# Remove a package
sudo dnf remove packagename
# Search by name or summary
dnf search keyword
# Show detailed package info
dnf info htop
# List all installed packages
dnf list installed
# Find which package provides a specific file or capability
dnf provides /usr/bin/htop
dnf provides 'libssl.so.3'
# Remove orphaned packages (auto-installed dependencies no longer needed)
sudo dnf autoremove
# Clean all cached data
sudo dnf clean all
# View transaction history
dnf history
# Undo a specific transaction (e.g., accidentally removed something)
sudo dnf history undo 47RPM Fusion — Essential Extra Packages for Fedora
Fedora's default repos exclude proprietary software and patents-encumbered codecs. RPM Fusion provides NVIDIA drivers, media codecs, and non-free software:
# Add RPM Fusion Free and Non-free repos
sudo dnf install
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Install multimedia codecs
sudo dnf groupinstall "Multimedia"
# Install NVIDIA proprietary driver
sudo dnf install akmod-nvidia
# Add a COPR (community repo, equivalent to Ubuntu PPAs)
sudo dnf copr enable atim/lazygit
sudo dnf install lazygitpacman — Arch Linux
pacman's syntax uses flags instead of subcommands: -S for sync (install/update), -R for remove, -Q for query the local database. It's compact but requires remembering the flag combinations. On a fresh Arch install, run pacman -Syu before anything else to bring the system fully up to date.
Core pacman Commands
# Sync database AND upgrade all packages — the standard update command
sudo pacman -Syu
# Install a package
sudo pacman -S htop
# Install without confirmation prompts (useful in scripts)
sudo pacman -S --noconfirm htop
# Remove a package only
sudo pacman -R packagename
# Remove package + unused dependencies
sudo pacman -Rs packagename
# Remove package + dependencies + config files (nuclear option)
sudo pacman -Rns packagename
# Search the sync database (official repos)
pacman -Ss keyword
# Show detailed package info (sync database)
pacman -Si htop
# Show info about an installed package (local database)
pacman -Qi htop
# List all installed packages
pacman -Q
# List only explicitly installed packages (not pulled in as deps)
pacman -Qe
# List orphaned packages (installed as deps, no longer needed)
pacman -Qtdq
# Remove all orphaned packages
sudo pacman -Rns $(pacman -Qtdq)
# Find which installed package owns a file
pacman -Qo /usr/bin/htop
# Clean package cache — remove versions no longer installed
sudo pacman -Sc
# Remove ALL cached packages (frees maximum space)
sudo pacman -SccAUR — Arch User Repository
The AUR hosts community-maintained PKGBUILDs — build scripts that compile and package software not in the official repos. Never use sudo to build AUR packages; always build as a regular user. An AUR helper automates this workflow:
# Install yay (AUR helper) — one-time setup
sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si # builds and installs yay; do NOT use sudo here
# yay mirrors pacman flags exactly
yay -S spotify # install from AUR
yay -Syu # update system packages + AUR packages
yay -Ss keyword # search official repos + AUR
yay -Rs packagename # remove
# paru is a Rust-based alternative with better security defaults
yay -S paruzypper — openSUSE
zypper wraps the libzypp library and integrates tightly with the Open Build Service (OBS), which hosts thousands of packages specifically built for openSUSE. On Tumbleweed (openSUSE's rolling release), zypper dup is the correct upgrade command — zypper update won't handle the more aggressive dependency changes a rolling release requires.
# Refresh all repository metadata
sudo zypper refresh
# Update installed packages (stable Leap release)
sudo zypper update
# Distribution upgrade — required on Tumbleweed rolling release
sudo zypper dist-upgrade
# Install a package
sudo zypper install htop
# Short form — zypper accepts abbreviated subcommands
sudo zypper in htop
# Remove a package
sudo zypper remove htop
sudo zypper rm htop
# Search by name or description
zypper search keyword
zypper se keyword
# Show detailed package info
zypper info htop
# Find which package provides a file
zypper what-provides /usr/bin/htop
zypper wp /usr/bin/htop
# List installed packages
zypper packages --installed-only
# Clean package cache
sudo zypper clean
# Add an OBS repository
sudo zypper addrepo
https://download.opensuse.org/repositories/home:user:project/openSUSE_Leap_15.6/home:user:project.repo
sudo zypper refresh
# List configured repositories
zypper reposSide-by-Side Command Reference
| Task | apt | dnf | pacman | zypper |
|---|---|---|---|---|
| Update package list | apt update | dnf check-update | pacman -Sy | zypper refresh |
| Upgrade all packages | apt upgrade | dnf upgrade | pacman -Su | zypper update |
| Update + upgrade (combined) | apt update && apt upgrade | dnf upgrade | pacman -Syu | zypper update |
| Install | apt install pkg | dnf install pkg | pacman -S pkg | zypper in pkg |
| Remove | apt remove pkg | dnf remove pkg | pacman -R pkg | zypper rm pkg |
| Remove + purge config | apt purge pkg | dnf remove pkg | pacman -Rns pkg | zypper rm --clean-deps pkg |
| Search | apt search kw | dnf search kw | pacman -Ss kw | zypper se kw |
| Package info | apt show pkg | dnf info pkg | pacman -Si pkg | zypper info pkg |
| List installed | apt list --installed | dnf list installed | pacman -Q |
|
