Skip to content
# Package management

APT (Debian/Ubuntu)

Install, update, remove and search for packages on Debian and Ubuntu with apt.

The basics

update refreshes the local package index from your configured repositories; it doesn't install anything by itself. Always run it before install or upgrade so you're not installing a stale version.

bash
sudo apt update
sudo apt install nginx
sudo apt remove nginx
sudo apt purge nginx   # also deletes its config files

Searching for a package

Not sure of the exact package name? search matches against names and descriptions.

bash
apt search redis
apt show redis-server   # details on a specific package

Keeping things tidy

autoremove drops packages that were pulled in as dependencies but are no longer needed by anything installed. autoclean clears out old downloaded .deb files from the local cache.

bash
sudo apt autoremove -y
sudo apt autoclean

apt vs apt-get

apt is the modern, user-facing command (better progress output, sane defaults) and is what these docs use throughout. apt-get is the older, more script-friendly interface β€” you'll still see it in tutorials and Dockerfiles, and the two are largely interchangeable for everyday use.