Skip to content

Common apt Commands

The Advanced Package Tool (apt) is the primary command-line utility for managing software on Debian-based systems, including Ubuntu.
It allows you to install, update, remove, and inspect software packages.

This page provides a reference list of common apt commands. Unlike tutorials or how-to guides, it is meant to be concise and scannable.


CommandPurposeExample
sudo apt updateRefresh package lists from repositoriessudo apt update
sudo apt upgradeUpgrade all upgradable packagessudo apt upgrade
sudo apt full-upgradeUpgrade packages and handle dependencies (may remove some packages)sudo apt full-upgrade

CommandPurposeExample
sudo apt install <package>Install a packagesudo apt install git
sudo apt remove <package>Remove a package (keep config files)sudo apt remove nginx
sudo apt purge <package>Remove a package and its config filessudo apt purge nginx

CommandPurposeExample
apt search <term>Search for packages by name/descriptionapt search curl
apt show <package>Display detailed information about a packageapt show htop
apt list --installedList installed packages`apt list —installed

CommandPurposeExample
sudo apt autoremoveRemove unused dependenciessudo apt autoremove
sudo apt cleanClear downloaded package files in cachesudo apt clean
sudo apt --fix-broken installFix broken dependenciessudo apt --fix-broken install

  • apt is a friendlier interface introduced in newer Ubuntu releases; apt-get still works but is more verbose.
  • Always run sudo apt update before installing to ensure you have the latest package information.
  • Combine with man apt for the complete manual.