apt-get - package manager for Debian and Ubuntu
apt [update|upgrade|install|remove|autoremove|list|show|search] [package...]
Options you will use
update- Refresh the package lists. Downloads NO packages. Always first.
upgrade- Install newer versions of everything installed.
install PKG- Install a package and its dependencies.
remove PKG- Remove a package but keep its config files.
purge PKG- Remove the package and its config.
autoremove- Remove dependencies nothing needs any more (old kernels live here).
list --installed / --upgradable- What is installed, or what has an update.
show PKG, search TERM- Package details, and search the descriptions.
-y, --yes- Assume yes. Required in scripts and CI.
Examples
$ sudo apt update && sudo apt upgrade -ythe pair, in that order
$ sudo apt install -y tree jqthe tools this course uses
Gotchas
- apt needs root for anything that writes: without sudo you get "Could not open lock file /var/lib/dpkg/lock-frontend - Permission denied".
Taught in
Try apt-get in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.