Pick Your Package Manager: apt, dnf, pacman

Every Linux distribution ships software in pre-built bundles called packages. The tool you use to install, update, and remove them is the package manager. Each major distro family has its own — same idea, different commands. You don’t pick a package manager; you pick a distro, and the package manager comes with it.

Why this matters

You will type your distro’s package manager 50 times a day. Knowing the right command for “install X,” “update everything,” “find Y,” and “remove Z” makes the shell feel native. Knowing the WRONG command for your distro just gives you “command not found.”

The four major package managers

Distro family Manager Package format
Debian, Ubuntu, Pop!_OS, Mint, Kali apt .deb
Fedora, RHEL, Rocky, Alma, CentOS dnf (or yum) .rpm
Arch, Manjaro, EndeavourOS pacman .pkg.tar.zst
openSUSE, SLES zypper .rpm
Alpine apk .apk

The Rosetta stone: same task, every manager

Task apt dnf pacman
Refresh package list apt update dnf check-update pacman -Sy
Upgrade all apt upgrade dnf upgrade pacman -Syu
Install apt install foo dnf install foo pacman -S foo
Remove apt remove foo dnf remove foo pacman -R foo
Search apt search foo dnf search foo pacman -Ss foo
List installed apt list --installed dnf list installed pacman -Q
What does this package contain? dpkg -L foo rpm -ql foo pacman -Ql foo
Which package owns this file? dpkg -S /path rpm -qf /path pacman -Qo /path

Which one you’ll use

Find out by trying:

command -v apt && echo "Debian/Ubuntu family"
command -v dnf && echo "Fedora/RHEL family"
command -v pacman && echo "Arch family"
cat /etc/os-release | head -2

Beyond the distro packages

Most modern distros also support cross-distro packaging:

  • Flatpak — sandboxed desktop apps. Single command on every distro: flatpak install ...
  • Snap — Canonical’s version. Pre-installed on Ubuntu.
  • AppImage — single-file portable apps. Download, chmod +x, run.
  • Nix — declarative, reproducible, cross-distro. Steeper learning curve.

For dev tools, language-specific package managers (npm, pip, cargo, gem) coexist with system packages.

Common mistakes

  • Mixing managers on the same package — installing nginx via apt AND via snap creates two of them.
  • Forgetting to update before install on apt — your local package list might be stale.
  • Running pacman -Sy foo instead of -Syu foo — partial updates break Arch.
  • Ignoring “transaction failed” warnings — fix them or you accumulate broken state.

What to learn next

Pick the deeper article that matches your distro: apt, dnf, or pacman. Each has nuance worth knowing if you’ll be using it daily.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *