LinuxCommandLibrary

apt-get

TLDR

Update the list of available packages

$ sudo apt-get update
copy
Install a package or update it to the latest version
$ sudo apt-get install [package]
copy
Remove a package
$ sudo apt-get remove [package]
copy
Remove a package and its configuration files
$ sudo apt-get purge [package]
copy
Upgrade all installed packages
$ sudo apt-get upgrade
copy
Clean the local repository of interrupted downloads
$ sudo apt-get autoclean
copy
Remove all packages that are no longer needed
$ sudo apt-get autoremove
copy
Upgrade and handle changing dependencies
$ sudo apt-get dist-upgrade
copy

SYNOPSIS

apt-get [options] command [package...]

DESCRIPTION

apt-get is the command-line package management utility for Debian and Ubuntu. It handles installation, upgrade, and removal of software packages. For interactive use, apt is recommended as a more user-friendly alternative.

PARAMETERS

update

Resynchronize package index files from sources
upgrade
Install newest versions of all currently installed packages
dist-upgrade
Upgrade and handle changing dependencies
install package
Install or upgrade specified packages
remove package
Remove packages
purge package
Remove packages and configuration files
autoremove
Remove automatically installed packages no longer needed
autoclean
Clear local repository of retrieved package files that can no longer be downloaded
clean
Clear local repository of all retrieved package files
download package
Download the binary package into the current directory
source package
Fetch source packages
-y, --yes
Automatic yes to prompts
-d, --download-only
Download packages but don't install
--no-install-recommends
Don't install recommended packages
-f, --fix-broken
Attempt to fix broken dependencies

CAVEATS

Run apt-get update before other commands to ensure the package list is current.

HISTORY

Part of the APT (Advanced Package Tool) suite developed for Debian in 1998 by the APT Development Team.

SEE ALSO

apt(8), apt-cache(8), dpkg(1), aptitude(8)

Copied to clipboard