Where to start First steps track · 15 stages
Linux Labs

apt / dpkg — package management

cheat sheet · Ubuntu 24.04 · Debian https://lab.dimsanych.ru/en/wiki/apt/

Cheat sheet

  • sudo apt update && sudo apt upgrade refresh the index, then install upgrades
  • sudo apt install nginx install a package
  • sudo apt purge nginx remove a package together with its config
  • sudo apt autoremove --purge remove orphaned dependencies
  • apt-cache policy nginx package versions and which repo they come from
  • dpkg -L nginx which files a package brought in
  • dpkg -S /usr/sbin/nginx which package owns a file
  • sudo apt --fix-broken install install missing dependencies after a failure
  • sudo dpkg --configure -a finish configuring a broken dpkg run
  • sudo apt-mark hold nginx pin 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.

Loading…