What is APT (Advanced Package Tool)?
APT handles software on Debian-based Linux distributions, including Ubuntu, Linux Mint and Raspberry Pi OS. It downloads packages from configured repositories, works out dependencies, installs everything in the right order and tracks what is installed so it can update or remove it later. Underneath, APT hands each .deb file to the lower-level dpkg tool for the actual install.
The everyday command is apt. The older apt-get and apt-cache commands still work and are preferred in scripts because their output format stays stable; apt combines their common functions with friendlier output such as progress bars.
Core commands
| Command | What it does |
|---|---|
sudo apt update | Downloads fresh package lists from the repositories; installs nothing |
sudo apt upgrade | Installs newer versions of installed packages without removing any |
sudo apt full-upgrade | Upgrades and may remove packages to resolve dependency changes |
sudo apt install curl | Installs a package and its dependencies |
sudo apt remove curl | Removes the package but keeps its configuration files |
sudo apt purge curl | Removes the package and its system-wide configuration files |
sudo apt autoremove | Removes dependencies that nothing needs anymore |
apt search, apt show | Finds packages and shows details |
apt list --upgradable | Shows which packages have updates waiting |
The classic exam trap is the difference between the first two lines. apt update only refreshes the catalog; apt upgrade actually installs updates. Routine maintenance is sudo apt update followed by sudo apt upgrade. Commands that change the system need root, so they run with sudo; searching and showing do not. Adding -y answers yes to prompts, which is common in scripts.
Repositories and trust
Repositories are listed in /etc/apt/sources.list and in files under /etc/apt/sources.list.d/. Repository data is signed, and APT refuses or warns about sources whose signatures it cannot verify. Installing from the distribution's repositories is safer than downloading a random .deb from a website, because repository packages receive security fixes through the normal upgrade cycle. A vendor .deb can be installed with sudo apt install ./package.deb, which also fetches its dependencies; sudo dpkg -i package.deb installs it without resolving dependencies.
Troubleshooting
- "Could not get lock /var/lib/dpkg/lock-frontend": another package process, often automatic updates, is running. Wait for it to finish instead of deleting lock files.
- "dpkg was interrupted": an earlier install stopped partway. Run
sudo dpkg --configure -a, then try again. - "Unable to locate package": check the spelling, run
sudo apt update, and confirm the repository that provides the package is enabled. - "Permission denied" or "are you root?": the command needs
sudo. - Broken dependencies:
sudo apt --fix-broken installtries to repair them. - Repository errors such as 404 or signature failures: a source address is out of date, a mirror is down or a key is missing. Fix the source rather than turning off signature checks.
APT compared with other package managers
| Platform | Tool | Package format |
|---|---|---|
| Debian, Ubuntu, Mint | apt (with dpkg) | .deb |
| Fedora, RHEL, Rocky Linux, AlmaLinux | dnf (with rpm) | .rpm |
| Windows | winget, Microsoft Store | .msi, .msix, .exe |
| macOS | App Store; Homebrew (third party) | .app, .pkg |
One difference catches people moving between families: dnf has no separate refresh step like apt update, because it refreshes its metadata on its own when needed.
APT (Advanced Package Tool) on the CompTIA A+ exam
APT is part of Core 2 (220-1202) objective 1.9, Linux basics and everyday commands. Know which distributions use it, the difference between apt update and apt upgrade, the install and remove syntax, and that system changes need sudo. If a question shows an Ubuntu or Debian system and asks how to install software, think sudo apt install. If it shows Fedora or Red Hat, the answer is dnf instead.