With the introduction of Ubuntu 16.04 LTS, the “apt” command started being noticed by bloggers and average Linux users.
Every Ubuntu-based tutorial that popped up on the internet used apt install instead of what we were normally used to seeing, i.e. apt-get install. Let’s see what exactly the apt command is, and why a new command was introduced.
The apt-get Command
Debian, the distribution on which Ubuntu, Linux Mint, and other popular distributions are built have a solid package manager called the APT – Advanced Packaging Tool. Now to interact with the package manager, there are various tools that were developed and have been used since the beginning.
The apt-get command is one of the packages that were developed to interact with the Debian package manager. Since apt-get had a lot of variations that users had to remember, it quickly became inefficient to use until you become familiar with the different options available.
That’s where the problem started being noticed. Someone had to develop a better solution. And this is what gave rise to the apt command.
The apt command
The apt command is the new command for managing packages in Debian, Ubuntu, and other Debian-based distributions. The functions in the apt-get command have been combined into the apt command and made easier to use than before.
What is Wrong with apt-get Command?
We all agree that apt-get is inefficient and lacks certain functionalities that should simply exist in a package manager. For example, you install an application using apt-get install but when you want to search a package, you can’t type apt-get search. You have to type apt-cache search.
Similarly, in case you want to list out all the packages that are installed in the system, the command is completely different. You enter dpkg –get-selections. A newbie user would just get confused and want to quit even before their journey in learning Linux starts.
How Does apt Command Solve these issues?
If I had to answer this question in one line, the answer would be: The apt command combines all the functionalities (including apt-get, apt-cache, dpkg) under one command to simplify interaction with the APT package manager.
What are the differences between the apt and the apt-get commands?
When you use the apt package manager, the first thing you will notice is that the output has colors. In the below image, I’ve run the following commands in the example images below.
root@HowLinux:~# apt-get update root@HowLinux:~# apt update root@HowLinux:~# apt-cache search root@HowLinux:~# apt search
Let’s see what is the difference in output.
Difference between apt vs apt-get command options
For simplification, we created a quick infographic that lists down the most commonly used command options and what the same option would be with the new apt command.
Though the apt-get command will stay active for backward compatibility, it’s best to start moving to the apt command in any scripts that you use in the future and even replace the apt-get from your existing scripts wherever possible.
As you can see above, the usage is simplified and prettified making it the obvious winner when it comes to user experience and friendliness for the future.
And as always, continue to make use of the man pages for all the commands that you wish to know more about. The options that we’ve listed above are a small bunch of frequently used ones. These should get you going, but for advanced usage, start reading the man pages to understand what different combinations you can make within the available options to make the command work more efficiently for you your automation scripts.