Package Management

apt

High-level package manager for Debian and Ubuntu with user-friendly output.

Synopsis

syntax
apt [OPTION]... COMMAND [PACKAGE]...

Examples

Update package index and upgrade all packages
sudo apt update && sudo apt upgrade
Install nginx
sudo apt install nginx
Search for Redis packages
apt search redis
Remove package and its config files
sudo apt remove --purge package-name
Clean up unused dependencies
sudo apt autoremove

Common options

FlagDescription
updateRefresh package index
upgradeUpgrade all packages
installInstall packages
removeRemove packages
searchSearch package names and descriptions
autoremoveRemove unneeded dependencies

About apt

The `apt` command high-level package manager for Debian and Ubuntu with user-friendly output. Package management commands install, update, and remove software on Linux distributions.

Each distribution family has its own package manager — apt for Debian/Ubuntu, yum/dnf for RHEL/Fedora, pacman for Arch, and so on. Understanding your distro's package manager is one of the first steps in Linux administration.

The command accepts 6 commonly used flags shown above, though the full set of options is available in the man page (`man apt`). The 5 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Package Management Commands

Other commands in the Package Management category

Related tools