Debian Ubuntu

Difference between apt vs. apt-get

Every Linux user knows the powerful apt and apt-get command and most probably used it for managing packages in their system. However, most of them do not understand the difference between apt and apt-get and often get confused when to use one or another. Both are open-source command-line tools that are used for managing packages such as installing, updating, upgrading, and removing. However, still there are some differences between them.

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:

$ sudo apt-get update

Now with the apt, you simply need to run:

$ sudo apt update

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

Function apt-get apt
Install package apt-get install

 

apt 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

 

apt full-upgrade

 

Search packages apt-cache search apt search
Show package information apt-cache show Apt show
Remove unwanted dependencies apt-get autoremove

 

apt 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.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn.