Brief: This article guide takes a look at the usage of ‘apt’ and ‘apt-get’ commands in Debian-based Linux distributions like Ubuntu and Linux Mint. It further clarifies the confusion that might be behind the usage of these two commands.
APT Command – Advanced Package Tool
Linux-based distributions like Debian, Ubuntu, and Linux Mint make use of the apt package management system to install, remove, update, and upgrade associated or targeted software packages.
Debian-based users take pride in the usage of the apt package management system because of the following prominent features:
apt Command Features
- Software Package Repositories – Before Debian-based users can install a targeted software package on their Linux system, the apt package manager first queries multiple software package repositories for the existence of the targeted software package. These online repositories simplify the search and installation process of an identified application.
- Dependencies Resolution – In Linux, it is common for a software package to depend on external libraries or other packages for it to fully install or function. If such dependencies are unmet, the apt package manager is able to resolve such dependencies prior to the installation of the package.
- Reliable Package Management – APT’s approach to package management is transactional. This functional feature ensures that any implementable system change is not only atomic but also reversible. Thus, when managing packages, prominent issues like broken dependencies are easily resolved.
- CLI and GUI Support – Debian-based distributions accommodate users with beginner to expert knowledge of Linux. The margin between these users forces them to either adapt to a command-line APT or a GUI APT. Therefore, users have the option of choosing the package management interface that suits their needs.
- Multiple Architecture Support – Whether a user adopts 32-bit or 64-bit versions of Debian-based Linux distributions, apt will extend its package management functionalities to these architectures without excluding the ARM and MIPS architectures.
- Support for Other Tools – APT is able to improve its package management capabilities by integrating with tools and services like ‘apt-config‘ and ‘apt-cache‘.
Difference between apt and apt-get Commands
The apt package manager makes use of both ‘apt‘ and ‘apt-get‘ commands to manage the installation, update, upgrade, search, download, and removal of associated software packages under a Debian-based Linux distribution.
Low-level package management tools e.g provided by the ‘dpkg‘ command, rely on the apt package manager as an ideal front-end.
apt Command
The onset of the ‘apt‘ command started in the year 2014 but became a prominent feature in Ubuntu 16.04. Users then became comfortable using ‘apt install software_package‘ instead of the ‘apt-get install software_package‘ command.
The ‘apt‘ command is APT’s prioritized tool of interaction and provides APT with a high-level interface (few functionalities are involved) during its package management routines. When used to manage package repositories, or upgrade an entire Debian-based system, the ‘apt‘ command is associated with multiple options.
The ‘apt‘ command is more structured, making it easy to workaround low-level commands like ‘apt-cache‘. Such command options are enabled by default. The apt command showcases a progress bar during package installation or system upgrade:
$ sudo apt update
Also, after running a system update command (apt update), the system user is informed of packages that need an upgrade:
apt-get Command
The ‘apt-get‘ command provides the APT package manager with a low-level interface (many functionalities are involved) during its package management routines.
The apt-get command is used by APT to manage individual or groups of packages, which can also be combined with other APT tools like ‘apt-config‘ or ‘apt-cache‘ to execute complex package management tasks. Automated environments and scripts also embody this command while managing packages.
While running the system update command with apt-get command (apt-get update), we do not get notified of pending package upgrades as with the apt command (apt update):
$ sudo apt-get update
In this case, a user will need to use the apt command to display packages with pending upgrades:
$ apt list --upgradable
Also, the apt-get command does not provide a progress bar during package installation as is the case with the apt command.
Implementation of apt and apt-get Commands
apt Command [NEW] | apt-get Command [OLD] | Command Function |
apt update |
apt-get update |
Refreshes package repository index |
apt upgrade |
apt-get upgrade |
Upgrade all packages |
apt full-upgrade |
apt-get dist-upgrade |
Upgrade packages and remove unnecessary dependencies |
apt install [package_name] |
apt-get install [package_name] |
Install a package |
apt remove [package_name] |
apt-get remove [package_name] |
Remove a package |
apt purge [package_name] |
apt-get purge [package_name] |
Remove a package with configuration |
apt autoremove [package_name] |
apt-get autoremove [package_name] |
Uninstallation of unused/unwanted packages |
apt search [package_name] |
apt-get search [package_name] |
Performs package or program search |
apt show [package_name] |
apt-cache show [package_name] |
Show package information |
apt policy [package_name] |
apt-cache policy [package_name] |
Show active package sources |
apt policy |
apt-cache policy |
Show installed and available versions of a package |
Additionally, the ‘apt‘ command can be associated with the following unique commands:
apt Command | Command Function |
apt list |
Implements a criteria-based listing of packages |
apt edit-sources |
Enables users to edit the sources list |
The apt-get command is useful for scripting and other low-level operations. Therefore, this command has not yet reached its end-of-life. However, the Debian Linux distribution community recommends the use of the apt command over apt-get due to its easy-to-remember and memorable options. On the other hand, if you are after specific operations with multiple features, then you should go with the apt-get command.
Note: Linux Mint users might be familiar with the apt python wrapper that implements an apt-get functionality with friendlier options. We should not draw any association between the apt command discussed in this article and the one initiated by a python in Linux Mint.
Conclusion
The APT package manager hosts both ‘apt‘ and ‘apt-get‘ commands. While the implementation of these two commands might be different, they are able to achieve the same Debian-based Linux OS functionality with the ‘apt‘ command going the extra mile.