dnf / pacman / zypper Cheat Sheet
Package managers for the other big Linux families: dnf (Fedora, RHEL, Rocky, Alma), pacman (Arch, Manjaro, EndeavourOS), zypper (openSUSE). All need sudo for changes. For Debian/Ubuntu see the apt sheet.
On this page
Side by Side #
| Task | dnf | pacman | zypper |
|---|---|---|---|
| Refresh repos | (only together with -u) | (ref) | |
| Update everything | (up) | ||
| Distro upgrade / rolling | (Tumbleweed) | ||
| Install | (in) | ||
| Install local file | |||
| Remove | () | ||
| Remove + unused deps + config | then | ||
| Search | (se) | ||
| Package info | (repo) / -Qi (installed) | ||
| List installed | |||
| Explicitly installed | — | ||
| Files in a package | |||
| Who owns a file | |||
| Remove orphans | |||
| Clean cache | (cc) | ||
| List repos | (lr) | ||
| Add a repo | edit /etc/pacman.conf | (ar) | |
| History / undo | / | /var/log/pacman.log | /var/log/zypp/history |
dnf Extras #
| Command | Action |
|---|---|
| Package groups | |
| Install a group | |
| Go back one version | |
| Enable RPM Fusion (codecs, drivers) on Fedora |
pacman / Arch Extras #
| Command | Action |
|---|---|
| / | Install from the AUR (community helpers) |
| Update repo + AUR packages | |
| List orphans | |
| Fix key errors |
Avoid pacman -Sy pkg on its own (a partial upgrade can break the system). Use pacman -Syu pkg.
zypper Extras #
| Command | Action |
|---|---|
| / | List / apply security patches (Leap) |
| / | Lock / unlock a package |
| Install from OBS community repos (with the tool) |
Universal Formats #
| Command | Action |
|---|---|
| Flatpak (works on every distro) | |
| Snap |
dnfPackage manager for Fedora, RHEL, Rocky and Alma Linux. sudo dnf [options] command [packages]
| Command / option | What it does |
|---|---|
install pkg | Install (also local ./file.rpm) |
remove pkg | Remove |
upgrade | Update everything (upgrade pkg for one) |
check-update | List available updates |
search word | Search |
info pkg | Details |
list --installed | Installed packages |
provides /path/file | Which package provides a file |
autoremove | Remove unneeded dependencies |
history / history undo N | Transaction history / undo one |
downgrade pkg / reinstall pkg | Go back one version / reinstall |
group list / group install "Name" | Package groups |
repolist | Enabled repositories |
clean all / makecache | Clear / rebuild the cache |
-y | Assume yes |
--refresh | Refresh metadata first |
--enablerepo=name / --disablerepo=name | Use / skip a repository for this command |
--allowerasing | Allow removing conflicting packages |
pacmanPackage manager for Arch, Manjaro and EndeavourOS. sudo pacman operation [options] [packages]
| Operation | What it does |
|---|---|
-S pkg | Install from the repositories |
-Syu | Refresh and upgrade everything (always upgrade fully) |
-Syu pkg | Upgrade everything and install a package |
-Ss word | Search the repositories |
-Si pkg | Info from the repository |
-R pkg | Remove |
-Rs pkg | Remove with its unneeded dependencies |
-Rns pkg | …and its config files |
-Q | List installed packages |
-Qe | Explicitly installed packages |
-Qi pkg / -Ql pkg | Info / files of an installed package |
-Qo /path/file | Which package owns a file |
-Qdt (-Qdtq) | Orphans (unneeded dependencies) |
-Qm | Foreign packages (AUR) |
-U file.pkg.tar.zst | Install a local package file |
-F file / -Fy | Which package contains a file (sync the file database with -Fy) |
-Sc / -Scc | Clean old / all cached packages |
--needed | Don't reinstall up-to-date packages |
--noconfirm | Don't ask questions |
Avoid pacman -Sy pkg on its own: partial upgrades can break the system.
zypperPackage manager for openSUSE. sudo zypper [global options] command [options]
| Command (short) | What it does |
|---|---|
refresh (ref) | Refresh repositories |
update (up) | Update packages (Leap) |
dist-upgrade (dup) | Full upgrade (Tumbleweed) |
install (in) pkg | Install |
remove (rm) pkg | Remove (-u / --clean-deps removes unneeded dependencies) |
search (se) word | Search (-i installed only, -s with versions) |
info pkg | Details |
what-provides (wp) file | Which package provides a file |
repos (lr) | List repositories |
addrepo (ar) URL name | Add a repository (-f = auto-refresh) |
removerepo (rr) name | Remove a repository |
clean (cc) | Clear the cache |
patches / patch | List / apply patches |
addlock (al) / removelock (rl) pkg | Lock / unlock a package |
packages --unneeded | Packages nothing needs |
ps -s | Programs still using deleted (updated) files |
-n | Non-interactive (assume yes) |
--gpg-auto-import-keys | Accept new repository keys |
rmDelete files and folders. There is no recycle bin. rm [options] file…
| Option | What it does |
|---|---|
-r, -R | Delete folders and everything in them |
-f | Force: no questions, no error if the file is missing |
-i | Ask before every file |
-I | Ask once (when deleting more than 3 files or recursively) |
-v | Show what is deleted |
-d | Delete empty folders |
--preserve-root | Refuse to delete / (on by default) |
--one-file-system | Don't cross into other mounted drives |
⚠ Double-check before rm -rf. Test the pattern first with ls: ls *.tmp → rm *.tmp.
rpmLow-level .rpm package tool (Fedora, openSUSE). rpm [options]
| Option | What it does |
|---|---|
-qa | List all installed packages |
-qi pkg | Info about an installed package |
-ql pkg | Files of a package |
-qf /path/file | Which package owns a file |
-qp file.rpm -l | Files inside an .rpm file |
-ivh file.rpm | Install with progress (no dependency resolving, prefer dnf/zypper) |
-Uvh file.rpm | Upgrade or install |
-e pkg | Remove |
-V pkg | Verify the installed files |
--import key.asc | Import a signing key |
catPrint files (or join them). cat [options] file…
| Option | What it does |
|---|---|
-n | Number every line |
-b | Number non-empty lines only |
-s | Squeeze multiple empty lines into one |
-A | Show invisible characters: tabs as ^I, line ends as $ |
-E | Show $ at every line end (spot trailing spaces) |
-T | Show tabs as ^I |
cat a b > ab | Join files into a new one |
cat >> notes.txt | Type text and append it (end with Ctrl + D) |
yayalso: paruAUR helpers: pacman + the Arch User Repository. yay [options] [packages] (paru works the same)
| Option | What it does |
|---|---|
yay | Same as yay -Syu: upgrade repo and AUR packages |
-S pkg | Install from the repositories or the AUR |
-Ss word / yay word | Search (plain yay word lets you pick from a list) |
-Sua | Upgrade AUR packages only |
-Rns pkg | Remove with dependencies and config |
-Yc | Remove unneeded dependencies |
-G pkg | Download the PKGBUILD only |
-Ps | Statistics |
--devel | Also check -git development packages for updates |
pacman-keyManage the keys pacman uses to verify packages. sudo pacman-key [options]
| Option | What it does |
|---|---|
--init | Create the local keyring |
--populate archlinux | Load the official Arch keys |
--refresh-keys | Update all keys from the keyservers |
--recv-keys ID | Fetch a specific key |
--lsign-key ID | Trust a key locally |
-l | List keys |
"Invalid or corrupted package (PGP signature)" is usually fixed by sudo pacman -Sy archlinux-keyring and then sudo pacman -Syu.
opiopenSUSE helper: install packages from the community build service (OBS) and Packman. opi [options] query
| Usage / option | What it does |
|---|---|
opi name | Search OBS and pick a package and repository to install |
opi codecs | Install multimedia codecs (Packman) |
opi vscode, opi chrome… | Built-in shortcuts for popular third-party software |
-n | Non-interactive: pick the first option |
flatpakInstall sandboxed apps on any distro. flatpak command [options]
| Command / option | What it does |
|---|---|
remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | Add the Flathub store |
install flathub app.id | Install an app |
run app.id | Start an app |
update | Update everything |
list --app | Installed apps |
search word | Search |
info app.id | Details |
uninstall app.id | Remove (--delete-data removes its data too) |
uninstall --unused | Remove runtimes nothing uses any more |
override --filesystem=home app.id | Give an app extra permissions |
--user / --system | Install for you only / for everyone |
snapInstall sandboxed Snap packages (Ubuntu). sudo snap command [options]
| Command / option | What it does |
|---|---|
install name | Install |
install name --classic | Install with full system access (editors, dev tools) |
install name --channel=beta | Other channel: stable, candidate, beta, edge |
remove name | Remove (--purge = no snapshot) |
list | Installed snaps |
refresh / refresh name | Update all / one |
revert name | Back to the previous version |
find word | Search the store |
info name | Details and channels |
disable / enable name | Turn off / on without removing |
logs name / services | Logs / background services |
connections name | Permissions (interfaces) of a snap |
Nothing on this sheet matches “”.