
The Linux apt and apt-get tools are probably one of the most frequently used command-line tools in Debian-based distros when it comes to handling software packages. The two are very similar, however, a few subtle differences exist between the two. In this guide, we will aim to distinguish between apt and apt-get and how they are used.
Evolution of apt command
To get a better grasp of the two commands, let's go back in time and see how the apt command evolved over time. Prior to Debian 8 (Jessie) and Ubuntu 16.04 (Xenial Xerus), users interacted with the APT package manager (Advanced Package Tool) using the apt-get command. However, the command-line tool did not get much traction from the users, and most did not exhaustively use most of the options that came with it.
The advent of Ubuntu 16.04 and Debian 8 saw the introduction of the apt command-line tool which is a more user-friendly tool and sought to merge the functionalities of apt-get and apt-cache
Differences between apt and apt-get command
Having looked at a brief history of the two commands, let now focus on the differences between the two.
1) Command syntax
The most obvious difference is the way the command syntax. For example, to update the package lists or package index using apt, run the command as follows:
$ sudo apt update
when using the apt-get command, invoke:
$ sudo apt-get update
To get a better sense of how you can run other operations using apt and apt-get commands, here is a brief summary in a tabular format.
Operation | apt-get | apt |
Update package lists | apt-get update | apt update |
Install a package | apt-get install package-name | apt install package-name |
Remove a package | apt-get remove package-name | apt remove package-name |
Upgrade packages | apt-get upgrade | apt upgrade |
Search packages | apt-cache search package-name | apt search package-name |
Display package info | apt-cache show package-name | apt show package-name |
Remove unwanted packages | apt-get autoremove | apt autoremove |
Purge a package along its config files | apt-get purge | apt purge |
2) Intuitive and more informative output
In addition to the stark differences between the two command-line tools, apt has infused a sense of novelty in the command output, and towards the end, gives you information regarding the number of updates due for upgrade. Additionally, it lets you in on how you can view those packages using the apt list --upgradable command.
$ sudo apt update

$ apt list --upgradable

With the apt upgrade command, a progress bar has been introduced at the bottom of the terminal indicating the progress of the package upgrade process.

3) Additional commands with apt
There are 2 command-line options that ship with APT.
apt list: This command lists the installed, available and upgradable packages.
apt edit-sources: When the command is executed for the first time, it presents you with a list of text editors that you can use to open and edit the sources list file - /etc/apt/sources.list. Once you select your preferred option, you will be able to directly edit the file for subsequent command executions.
Conclusion
While you can still use the apt-get command to get things done, the apt command gives you an easier time and does a better job in helping you manage your packages. It's easier to run on the terminal and , as mentioned earlier, ships with additional command options.
Very good article to teach to newbies and also to many who think they are not so new to Linux