The same jobs, three spellings. This pairs with the package management post — read that for the why; keep this for the how. Columns are apt (Debian, Ubuntu), dnf (Alma, RHEL, Fedora) and pacman (Arch). Anything that changes the system wants sudo; the read-only queries do not.
Install and remove
| Task | apt | dnf | pacman |
|---|---|---|---|
| Install a package | apt install foo | dnf install foo | pacman -S foo |
| Install a local file | apt install ./foo.deb | dnf install ./foo.rpm | pacman -U foo.pkg.tar.zst |
| Remove a package | apt remove foo | dnf remove foo | pacman -R foo |
| Remove + its config + unused deps | apt purge foo | dnf remove foo | pacman -Rns foo |
| Reinstall | apt install --reinstall foo | dnf reinstall foo | pacman -S foo |
Update and upgrade
| Task | apt | dnf | pacman |
|---|---|---|---|
| Refresh the catalogue | apt update | dnf check-update | pacman -Sy |
| Upgrade everything | apt upgrade | dnf upgrade | pacman -Su |
| Refresh and upgrade in one | apt update && apt upgrade | dnf upgrade | pacman -Syu |
| Upgrade a single package | apt install --only-upgrade foo | dnf upgrade foo | pacman -S foo |
Note
apt update refreshes the catalogue; it does not install anything. apt upgrade is what installs the newer versions. Never run upgrade without a fresh update first, or you are upgrading against yesterday’s list. On pacman, never -Sy without the u — a “partial upgrade” is a well-known way to break an Arch box.
Search and inspect
| Task | apt | dnf | pacman |
|---|---|---|---|
| Search for a package | apt search foo | dnf search foo | pacman -Ss foo |
| Show details of a package | apt show foo | dnf info foo | pacman -Si foo |
| List installed packages | apt list --installed | dnf list installed | pacman -Q |
| Is this one installed? | apt list --installed foo | dnf list installed foo | pacman -Qi foo |
| Which package owns a file? | dpkg -S /path/to/file | dnf provides /path/to/file | pacman -Qo /path/to/file |
| List files a package installed | dpkg -L foo | rpm -ql foo | pacman -Ql foo |
Housekeeping
| Task | apt | dnf | pacman |
|---|---|---|---|
| Remove no-longer-needed deps | apt autoremove | dnf autoremove | pacman -Rns $(pacman -Qtdq) |
| Clear the download cache | apt clean | dnf clean all | pacman -Sc |
| List orphaned packages | apt-mark showauto | dnf repoquery --unneeded | pacman -Qtdq |
Repositories and keys
| Task | apt | dnf | pacman |
|---|---|---|---|
| List configured repos | ls /etc/apt/sources.list.d/ | dnf repolist | cat /etc/pacman.conf |
| Add a third-party repo | add-apt-repository ppa:name | dnf config-manager --add-repo URL | edit /etc/pacman.conf |
Warning
Every third-party repo or PPA is a party you have granted root-level install rights on your machine, and nobody vets it but you. Add them deliberately, from sources you would vouch for. And never pipe a remote script straight into a root shell (curl … | sudo bash) without reading it first — download it, open it, then decide.
Universal packages
| Task | Snap | Flatpak |
|---|---|---|
| Install | snap install foo | flatpak install foo |
| Remove | snap remove foo | flatpak uninstall foo |
| List installed | snap list | flatpak list |
| Update everything | snap refresh | flatpak update |
AppImage has no manager by design: chmod +x foo.AppImage then ./foo.AppImage. To remove one, delete the file.
