Skip to content

linux (debian) apt vs apt-get

apt vs apt get

The apt command utility is a successor to the earlier apt-get.

The Debian package management infrastructure has been a feature of Debian since early on. At the heart of Debian package management is dpkg [1], a low-level tool used for installing and removing Debian .deb packages. The bigger and more comprehensive Advanced Package Tool (APT) [2] includes dpkg on the back end. APT performs most of the other functions associated with a package management system, including integrating external repositories.

The APT package system supports a number of front-end applications, both command-line and GUI-based for managing Debian packages. The majority of Debian administrators are familiar with the two step updating sequence of (1) sudo apt-get update followed by (2) sudo apt-get upgrade for standard package update management. Then of course there is the common sudo apt-get install xxxx for enhancing the system with additional packages.

Some users weren’t happy about the complex, and sometimes confusing, system of apt-get commands and options. Since around 2014 all users of Debian-based systems can enjoy a new command-line interface to the APT system: apt. The apt utility consolidates features that were once spread among apt-getapt-cache, and other commands, and it simplifies many of the command options for an easier and friendlier user experience.

The apt utility has been used in the Debian “Unstable” edition since 2014, and it became official with Debian 8. Because apt-get still works in recent releases of Debian and other Debian-based distros, many users have not taken the time to learn about apt. This article introduces the apt package management tool and explores some of the differences between apt and apt-get.

Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

Most used commands:
list – list packages based on package names
search – search in package descriptions
show – show package details
install – install packages
reinstall – reinstall packages
remove – remove packages
autoremove – Remove automatically all unused packages
update – update list of available packages
upgrade – upgrade the system by installing/upgrading packages
full-upgrade – upgrade the system by removing/installing/upgrading packages
edit-sources – edit the source information file

Usage: apt-get [options] command
apt-get [options] install|remove pkg1 [pkg2 …]
apt-get [options] source pkg1 [pkg2 …]

apt-get is a command line interface for retrieval of packages
and information about them from authenticated sources and
for installation, upgrade and removal of packages together
with their dependencies.

Most used commands:
update – Retrieve new lists of packages
upgrade – Perform an upgrade
install – Install new packages (pkg is libc6 not libc6.deb)
reinstall – Reinstall packages (pkg is libc6 not libc6.deb)
remove – Remove packages
purge – Remove packages and config files
autoremove – Remove automatically all unused packages
dist-upgrade – Distribution upgrade, see apt-get(8)
dselect-upgrade – Follow dselect selections
build-dep – Configure build-dependencies for source packages
clean – Erase downloaded archive files
autoclean – Erase old downloaded archive files
check – Verify that there are no broken dependencies
source – Download source archives
download – Download the binary package into the current directory
changelog – Download and display the changelog for the given package

See apt-get(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).

Usage: apt-cache [options] command
apt-cache [options] show pkg1 [pkg2 …]

apt-cache queries and displays available information about installed
and installable packages. It works exclusively on the data acquired
into the local cache via the ‘update’ command of e.g. apt-get. The
displayed information may therefore be outdated if the last update was
too long ago, but in exchange apt-cache works independently of the
availability of the configured sources (e.g. offline).

Most used commands:
showsrc – Show source records
search – Search the package list for a regex pattern
depends – Show raw dependency information for a package
rdepends – Show reverse dependency information for a package
show – Show a readable record for the package
pkgnames – List the names of all packages in the system
policy – Show policy settings

See apt-cache(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).

Feel free to comment