$linuxjunkies
>

apt(8)

Command-line interface for managing Debian packages; install, update, remove, and search for software.

UbuntuDebianFedoraArch

Synopsis

apt [OPTION]... COMMAND [ARG]...

Description

apt is a high-level package management tool that simplifies software installation and maintenance on Debian and Ubuntu systems. It combines functionality from apt-get and apt-cache, providing an intuitive interface for installing updates, managing dependencies, and resolving package conflicts.

Before using apt to install packages, update your package lists with apt update. Most operations require root privileges via sudo.

Common options

FlagWhat it does
-y, --yesAssume yes to all prompts; skip interactive confirmations
-q, --quietSuppress output messages; useful for scripting
-V, --verbosePrint extra information during operations
--no-install-recommendsSkip recommended packages; install only dependencies
--no-upgradeDo not upgrade packages during install
-s, --simulateSimulate the operation without making changes
--reinstallReinstall a package even if already installed
--autoremoveRemove unused dependencies automatically

Examples

Refresh package lists from configured repositories; run before installing new packages

sudo apt update

Install the curl package and resolve all required dependencies

sudo apt install curl

Upgrade all installed packages to their newest available versions

sudo apt upgrade

Upgrade packages while intelligently handling dependency changes and removals

sudo apt full-upgrade

Search package lists for packages matching 'vim' without requiring sudo

apt search vim

Remove the apache2 package while keeping its configuration files

sudo apt remove apache2

Remove apache2 package and delete all associated configuration files

sudo apt purge apache2

Remove packages that were automatically installed as dependencies and are no longer needed

sudo apt autoremove

Related commands