Operating Systems

What is APT (Advanced Package Tool)?

APT (Advanced Package Tool) is the package manager for Debian, Ubuntu and related Linux distributions that installs, updates and removes .deb packages.

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

CommandWhat it does
sudo apt updateDownloads fresh package lists from the repositories; installs nothing
sudo apt upgradeInstalls newer versions of installed packages without removing any
sudo apt full-upgradeUpgrades and may remove packages to resolve dependency changes
sudo apt install curlInstalls a package and its dependencies
sudo apt remove curlRemoves the package but keeps its configuration files
sudo apt purge curlRemoves the package and its system-wide configuration files
sudo apt autoremoveRemoves dependencies that nothing needs anymore
apt search, apt showFinds packages and shows details
apt list --upgradableShows 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 install tries 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

PlatformToolPackage format
Debian, Ubuntu, Mintapt (with dpkg).deb
Fedora, RHEL, Rocky Linux, AlmaLinuxdnf (with rpm).rpm
Windowswinget, Microsoft Store.msi, .msix, .exe
macOSApp 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.

Studying for CompTIA (Operating Systems)?

ExamWizardz turns the official objectives into a guided study plan — with practice tests, realistic PBQs, and a readiness score. Start free.

Start studying free

Related terms