apt / dpkg — package management
cheat sheet · Ubuntu 24.04 · Debian https://lab.dimsanych.ru/en/wiki/apt/Cheat sheet
-
sudo apt update && sudo apt upgraderefresh the index, then install upgrades -
sudo apt install nginxinstall a package -
sudo apt purge nginxremove a package together with its config -
sudo apt autoremove --purgeremove orphaned dependencies -
apt-cache policy nginxpackage versions and which repo they come from -
dpkg -L nginxwhich files a package brought in -
dpkg -S /usr/sbin/nginxwhich package owns a file -
sudo apt --fix-broken installinstall missing dependencies after a failure -
sudo dpkg --configure -afinish configuring a broken dpkg run -
sudo apt-mark hold nginxpin a package's version
Options
apt is built around subcommands (apt install, apt remove, …) rather than
flags of a single command; below are the main subcommands and flags. The full
list is in man apt, man dpkg.