Last Updated:

Difference Between apt and apt-get on Linux

Many Linux users often do not understand the difference between apt and apt-get, which is not surprising: both utilities are used to install, update, remove packages and are similar to each other in many ways. In this article, we will discuss the difference between apt and apt-get.

Notes It is possible to distinguish between the apt and APT (Advanced Packaging Tool) commands, because despite the similarity of their names, they are still different concepts.

What is APT?

 

APT (Advanced Packaging Tool) is a set of command-line utilities that you can use to interact with the dpkg package management system used in Debian and other Debian-based distributions.

Utilities such as apt, apt-get, apt-cache, apt-config, and aptitude (graphical interface to APT) interact with APT to perform various actions on a package (install, update, and uninstall).

apt utility

 


 

apt is a command-line utility for installing, updating, and uninstalling packages in Ubuntu, Debian, and derivative distributions. It combines the functionality of apt-get, apt-cache and dpkg. The apt utility was created with the intention of correcting the shortcomings present in apt-get, and does not contain some functionality of the apt-get utility.

apt-get utility

 

apt-get is a console-based package management utility that is widely used on Debian-based systems. The apt-get command allows you to install, update, and uninstall packages. To search for new packages, use the apt-cache command.

apt-get can be thought of as a lower-level add-on for APT.

What's wrong with apt-get?

 

The apt-get utility is inefficient and lacks certain features that should exist in a package manager. For example, you use the command to install an application, but when you want to search for the desired package, you will not be able to simply type . You must use the .apt-get installapt-get searchapt-cache search

Similarly, if you want to list all the packages installed on the system, the command will be completely different – . A novice user will simply get confused about them and want to leave before his journey to learn Linux begins.dpkg --get-selections

The functionality of the commands that the apt utility replaces is as follows:

   apt-get - Used to install, update, and uninstall packages.

   apt-cache — used to search for packages;

   dpkg -l - Used to enumerate all the packages installed on the system.

 

How does apt solve this problem?

 

The apt utility combines apt-get functionality (including apt-cache and dpkg) into a single command, simplifying interaction with APT.

Apt get

So apt-get is outdated?

 

There is no official information about the termination of support for apt-get. And that's not going to happen in the near future, as apt-get still offers more functionality than apt.

The apt-get command will continue to be used to perform all sorts of low-level operations, write scripts, etc. And the apt command is simply a more convenient utility for the end user, simplifying interaction with the Linux system.

What is the difference between apt and apt-get?

 


 

There are 5 main differences between apt and apt-get:

 apt has a beautiful progress bar;

 apt displays a list of packages that can be upgraded;

 apt combines the functions apt-get, apt-cache, and dpkg -l;

 apt has new commands;

 different syntax of the apt and apt-get commands.

apt has a beautiful progress bar

 

When you install or uninstall a package by using the apt command, a progress bar is displayed that shows the percentage progress of the current task:

 

apt displays a list of packages that can be updated

 

When you upgrade the repository database, an additional row is displayed with information about the number of packages that can be upgraded:

 

You can then request a list of these packages by running the . Pay attention to the improved color design, which helps to more accurately focus on the elements you need:apt list --upgradable

 

apt combines the functions apt-get, apt-cache, and dpkg -l

 

Prior to Ubuntu 16.04, users interacted with APT mostly only through apt-get, apt-config, and apt-cache. These utilities support many different additional commands (for example, apt-get install/remove/update/upgrade/help, etc.), and users had to memorize them. In this regard, the question arose of creating a simpler tool for managing the package base, which would consist only of the most necessary commands.

With the release of Ubuntu 16.04 and Debian 8, apt became such a tool, combining the capabilities of apt-get and apt-cache. The apt utility is more convenient to use compared to existing tools from the APT set. In addition, you no longer need to switch between apt-get and apt-cache.

apt has new commands

 

In addition to simplifying existing commands, apt has several new ones:

apt commandAssign a command
apt listDisplays a list of installed and available packages for upgrading.
apt edit-sourcesEdit the /etc/apt/sources.list file, which contains a list of repositories from which packages can be downloaded.

Different syntax of apt and apt-get commands

 

Although the apt utility combines the functionality of the apt-get and apt-cache utilities, not all of its commands are backward compatible with apt-get. For this reason, you may not always be able to replace the apt-get command with the apt command. The following table shows a small comparison of the apt and apt-get commands:

aptapt-getAssign a command
apt updateapt-get updateUpdate the list of available packages.
apt install [package_name]apt-get install [package_name]Install the package.
apt upgradeapt-get upgradeInstall newer versions of packages.
apt full-upgradeapt-get dist-upgradeUpdate all packages and remove unnecessary dependencies.
apt remove [package_name]apt-get remove [package_name]Delete the package.
apt purge [package_name]apt-get purge [package_name]Complete removal of the package along with all its configuration files.
apt autoremoveapt-get autoremoveRemove unnecessary dependencies.
apt search [package_name]apt-cache search [package_name]Search for a package by its name.
apt show [package_name]apt-cache show [package_name]Displays information about the package.
apt policyapt-cache policyDisplays information about the repositories used and their priority.
apt policy [package_name]apt-cache policy [package_name]Displays information about the version of the package that is installed and the version of the package that is available for upgrading.

 

So should I use apt or apt-get?

 

The apt command is recommended for use by the Linux distributions themselves. It provides the necessary capabilities for package management, and it is easier to use due to fewer options, which, nevertheless, are easy to remember.

The apt-get command remains active for backward compatibility and is used in specific cases where the functionality of the apt command is lacking.