Linux package management spans multiple ecosystems: APT/dpkg for Debian/Ubuntu, DNF/rpm for RHEL/Fedora, pacman for Arch Linux, plus cross-distro tools like Homebrew, snap, and Flatpak. Each manager handles dependency resolution, repository sources, and package lifecycle—install, update, remove, and query—through its own command syntax and configuration files. This cheat sheet covers the core commands and advanced workflows for all major package managers, with dpkg and rpm low-level tools included for direct package inspection and scripting.
What This Cheat Sheet Covers
This topic spans 12 focused tables and 140 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: APT Core Commands (Debian/Ubuntu)
APT (Advanced Package Tool) is the primary package manager for Debian and Ubuntu. These commands cover the full lifecycle: syncing the package index, installing, upgrading, removing, and querying packages. Run apt update before any install or upgrade to ensure you're working with current package metadata.
| APT Core Command | Example | Description |
|---|---|---|
apt update | Refresh package index from all configured repositories | |
apt upgrade | Upgrade all installed packages to newest available version | |
apt full-upgrade | Upgrade packages, allowing removal of obsolete packages if needed | |
apt install nginx | Install a package and all its dependencies | |
apt install nginx=1.24.0-1 | Install a specific version of a package | |
apt reinstall nginx | Reinstall a package without removing user configuration | |
apt remove nginx | Remove a package, keeping its configuration files | |
apt purge nginx | Remove a package including all its configuration files |