Back to the command reference

apt

SystemBeginnerReference only

Package manager for Debian/Ubuntu

Name: apt = Advanced Package Tool

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

apt is the main package command on Debian, Ubuntu and relatives: it downloads, installs, upgrades and removes software from repositories and resolves dependencies. Run apt update first to refresh the package lists.

apt is designed for interactive use; scripts should prefer apt-get, whose interface is stable.

Syntax

apt [OPTION]... COMMAND

Common options

updateRefresh package lists
upgradeUpgrade installed packages
full-upgradeUpgrade, removing packages if needed (for big upgrades)
install / removeInstall / remove packages
purgeRemove a package and its configuration files
autoremoveRemove dependencies nothing needs any more
searchSearch for packages
showShow a package’s details (version, dependencies, description)
list --installedList installed packages
-yAnswer yes to every question

Examples

  • $ sudo apt update && sudo apt upgrade

    Update the system

    Explain
  • $ sudo apt install git

    Install git

    Explain
  • $ apt search nginx

    Search packages

    Explain

Related