In this article, we will explain the difference between apt and the apt-get commands in Linux. We will also discuss a few of the most often used apt commands that replaced the apt-get command.
Apt- Brief history
The apt command-line utility was introduced in 2014 for the .deb packages of Debian distribution. It was first used in the unstable version of Debian and then became standard in Debian 8. Initially, it did not gain much attention from users, and they kept using the old and familiar apt-get command. However, after the release of Ubuntu 16.04, it start gaining popularity and somehow replaced the apt-get.
Difference between apt-get and apt
The first difference you will note among the apt and apt-get is the command itself. For instance, if you want to use apt-get update to update system repository index, you would run:
Now with the apt, you simply need to run:
The apt update command not just update the repository index but also tells if and how many new versions of the software are available in the repository.
Let us see some more apt commands which replaced the apt-get. To view these commands, you can type apt help or visit the apt man page by typing apt man in the Terminal. It will display all the information related to apt
|Install package||apt-get install
|Remove package||apt-get remove||apt remove|
|Update all package||apt-get upgrade||apt upgrade|
|Update all packages (auto handling of dependencies)||apt-get dist-upgrade
|Search packages||apt-cache search||apt search|
|Show package information||apt-cache show||Apt show|
|Remove unwanted dependencies||apt-get autoremove
|Removes package with associated configuration||Apt-get purge||apt purge|
In the above table, all the commands are same if you replace apt-get by apt except for the apt upgrade command. The old apt-get upgrade command updates all the packages which currently exist in your system. It does not install or remove the existing package on your system.
However, the new apt upgrade command installs packages that were added as dependencies of upgradable packages. Although similar to the apt-get upgrade, it also does not remove the packages that were previously installed.
In addition, the apt show command prints the output in alphabetical order and hides some less important information that was shown by the apt-cache show command.
The difference between the apt and apt-get is not limited to just the commands. Another visual feature has been added to the new apt command to make it pleasant for end users. Whenever a package is updating while using an apt upgrade, apt full-upgrade, or apt dist-upgrade, you will see a progress bar informing you of the progress of the process. It also appears when you remove the package using apt remove or apt purge.
Moreover, if we run apt list –upgradable, it also shows some colors to provide a clear overview of the packages for which the repository offers a most up to date version.
Two new commands:
Other than the replacement commands, there are two new commands introduced with the apt: apt list and apt edit-sources.
- apt list – when apt list command is used with –installed or –upgradeable, it lists the packages that are installed, available to install or those that need to be upgraded.
- apt edit-sources – when this command is used, it opens the sources.list file in an editor for editing.
Apt-get is still not entirely replaced by the apt, and I think it will not be completely discontinued ever. However, you might be thinking about what you should opt for: apt or apt-get. In my opinion, opting for apt will be worthwhile as it provides all the required functions for package management and is faster, more-friendlier, and easy to use.