Linux Package Management Cheat Sheet

Comprehensive Linux package management reference for apt, dnf, yum, pacman, zypper, rpm, and dpkg workflows across common distributions.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

APT and Debian/Ubuntu

Manage packages on Debian, Ubuntu, and apt-based systems.

Refresh package index

Download latest package metadata.

bashLINUXaptpackagedebian
bash
sudo apt update
Notes

Run before installs or upgrades so package metadata is current.

Upgrade installed packages

Upgrade installed packages without removing old ones.

bashLINUXaptupgradedebian
bash
sudo apt upgrade
Notes

Use `full-upgrade` when dependency changes are expected.

Perform full upgrade

Handle dependency changes and package removals if needed.

bashLINUXaptupgradedebian
bash
sudo apt full-upgrade
Notes

Useful before major maintenance windows or distro transitions.

Install package

Install one or more packages.

bashLINUXaptinstalldebian
bash
sudo apt install nginx curl jq
Notes

APT resolves dependencies automatically.

Remove package

Remove a package but keep config files.

bashLINUXaptremovedebian
bash
sudo apt remove nginx
Notes

Use `purge` to remove config files too.

Purge package and config

Remove package plus configuration files.

bashLINUXaptpurgedebian
bash
sudo apt purge nginx
Notes

Useful when resetting a package to a clean state.

Show package details

Display package metadata.

bashLINUXaptshowdebian
bash
apt show nginx
Notes

Useful for version, dependencies, and package description.

List upgradable packages

Show packages that can be upgraded.

bashLINUXaptupgradedebian
bash
apt list --upgradable
Notes

Good for change planning and patch windows.

Find package owning a file

Determine which package installed a path.

bashLINUXdpkgpackagedebian
bash
dpkg -S /usr/bin/psql
Notes

Very useful when auditing system files.

List installed packages

Show locally installed dpkg packages.

bashLINUXdpkglistdebian
bash
dpkg -l | less
Notes

Classic package inventory on Debian-family systems.

DNF and Yum for RHEL family

Manage packages on Fedora, Rocky, AlmaLinux, CentOS Stream, and older yum systems.

Check available updates

Query repositories for updates.

bashLINUXdnfyumrhel
bash
sudo dnf check-update
Notes

A safe way to inspect available package updates before applying them.

Upgrade packages

Upgrade installed packages to latest versions.

bashLINUXdnfupgraderhel
bash
sudo dnf upgrade
Notes

Common patching command on modern RHEL-family systems.

Install package

Install packages with dependencies.

bashLINUXdnfinstallrhel
bash
sudo dnf install nginx jq
Notes

DNF replaced yum on newer Fedora/RHEL-family systems.

Remove package

Uninstall packages from the system.

bashLINUXdnfremoverhel
bash
sudo dnf remove nginx
Notes

Useful for package cleanup and rollback.

Show package information

Display version and package metadata.

bashLINUXdnfinforhel
bash
dnf info nginx
Notes

Good for version checks and repository details.

Install package group

Install a named group of packages.

bashLINUXdnfgrouprhel
bash
sudo dnf groupinstall 'Development Tools'
Notes

Useful for compilers, build tools, or server roles.

Install package with yum

Install packages on older yum-based systems.

bashLINUXyuminstallrhel
bash
sudo yum install nginx
Notes

Still relevant on older enterprise environments.

Query installed package

Inspect installed rpm metadata.

bashLINUXrpmqueryrhel
bash
rpm -qi openssh-server
Notes

Useful even when yum or dnf is unavailable.

Find package owning a file

Identify which rpm package owns a path.

bashLINUXrpmfile-ownerrhel
bash
rpm -qf /usr/sbin/sshd
Notes

Useful for auditing binaries and config origins.

Pacman and Zypper

Manage packages on Arch-based and SUSE-based systems.

Refresh package databases

Synchronize package databases on Arch.

bashLINUXpacmanarchpackage
bash
sudo pacman -Sy
Notes

Often paired with `-u` for a full system update.

Full system upgrade on Arch

Synchronize package databases and upgrade packages.

bashLINUXpacmanarchupgrade
bash
sudo pacman -Syu
Notes

The standard full-update command on Arch-based systems.

Install package on Arch

Install one or more packages.

bashLINUXpacmanarchinstall
bash
sudo pacman -S nginx jq
Notes

Arch package installation command.

Remove package on Arch

Uninstall packages.

bashLINUXpacmanarchremove
bash
sudo pacman -Rns nginx
Notes

`-Rns` also removes unneeded dependencies and config backups where possible.

Refresh repositories on SUSE

Refresh package metadata.

bashLINUXzyppersusepackage
bash
sudo zypper refresh
Notes

Run before install or patch operations.

Update packages on SUSE

Upgrade installed packages.

bashLINUXzyppersuseupgrade
bash
sudo zypper update
Notes

The standard package update workflow on zypper systems.

Install package on SUSE

Install one or more packages.

bashLINUXzyppersuseinstall
bash
sudo zypper install nginx jq
Notes

Package installation workflow on openSUSE/SLES.

Remove package on SUSE

Uninstall a package.

bashLINUXzyppersuseremove
bash
sudo zypper remove nginx
Notes

Useful for cleanup or rollback.