On Linux operating systems that use the APT package management system, the apt command installs, removes, upgrades, and manages software packages. It automatically manages package dependencies, installing required software as needed, and removing it when no longer required.

Description

The apt command performs a similar function to apt-get, but with some additional functions, conveniences, and features. For instance, it provides colorization and fancier formatting of text output, and an animated progress bar when installing software. However, these formatting changes make apt unsuitable for capturing output to a file, or processing it with another tool such as grep. If you need to save or process the output of apt, it’s a good idea to use apt-get instead.

  • Syntax
  • Commands
  • Options
  • Examples
  • Related commands
  • Linux commands help

Apt is available on several modern Linux distributions, primarily Debian and Ubuntu. It is also available on Windows 10 systems that use the default Ubuntu Windows Subsystem for Linux.

Syntax

apt [-h] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {list | search | show | update | install pkg [{=pkg_version_number | /target_release}]… | remove pkg… | upgrade | full-upgrade | edit-sources | {-v | –version} | {-h | –help}}

Commands

Options

Examples

sudo apt update && sudo apt upgrade

Update information about available packages, and then upgrade all installed packages on your system. You will be prompted before installation begins.

Any commands listed below that make changes to your system must be run by the superuser, or with the sudo command.

sudo apt update && sudo apt -y upgrade

Same as above, but automatically answer yes to the prompt.

sudo apt install vim

Install the vim software package and its dependencies.

sudo apt install “vim*”

Install any packages whose name starts with “vim”. The package name is enclosed in quotes to make sure the wildcard ("*", meaning match anything) is passed to apt rather than interpreted by the shell.

apt show fortune

Display information about the package named fortune.

sudo apt install lolcat vim-gnome-

Install the package lolcat, and remove the package vim-gnome.

sudo apt remove lolcat+ vim-gnome

Remove the package vim-gnome, and install the package lolcat.

apt list –all-versions zypper

List all available versions of the software package zypper.

sudo apt install zypper=1.12.4-1

Install version 1.12.4-1 of zypper.

sudo apt install zypper/xenial

On Ubuntu, install the default version of zypper provided by Ubuntu 16.04, whose codename is xenial.

apt-cache — Get information about software packages available through APT.apt-file — Search for individual files in all available APT packages.apt-get — Command line tool for managing APT software packages.apt-mark — Change or view the settings of individual APT packages.aptitude — Text-based front end for the APT package management system.dpkg — Install, remove, and maintain Debian software packages.