28.4 C
New York
Friday, July 1, 2022
HomeLinuxLinux CLI ToolsApt vs Apt-get Commands Explained: Which One To Use?

Apt vs Apt-get Commands Explained: Which One To Use?

As a regular Ubuntu or Debian Linux user, you might have noticed that some package installer, removal, or updating commands use the apt command instead of the apt-get command. Now, as a day-to-day Linux user, you would not get to know what they are and which command is used for what! But as a power Linux/Ubuntu user, you definitely must know the difference between apt vs apt-get commands.

In the default command lists of Ubuntu, the apt-get command has been widely used for a long while. The new apt command was introduced a few years ago to increase the work efficiency and make the commands process simpler. Though there are some packages that only work with apt-get, hence most cache loading and cache removing or updating functions are nowadays done by the apt command.

Apt vs Apt-get Command

Most Ubuntu users already use the apt and apt-get command for managing packages on the system. It’s not a rookie mistake to get confused with when to use the apt command and when to use the apt-get command. In the history of using apt-get command, it was very much popular back a few years ago.

Ever since Ubuntu and other Linux distributions started using the apt command instead of the old apt-get command the apt-get got a bit deserted. In the entire post, we will briefly describe what an apt and apt-get command is when to use which command and the vital differences between these two apt vs apt-get commands on Linux.

1. apt vs apt-get: Repository Update

We all know the most popular and frequently used sudo apt-get update command, this command ends with reading the package list Done. It would update the repository only, it will not give any other extra info about packages.

But, when we run the sudo apt update command, it will display additional pieces of information about the repository and packages, like how many packages are ready for an update.

sudo apt update

sudo apt update

Here we can see that in the race of apt vs apt-get commands, the apt wins as it shows more detailed info on the shell.

2. apt vs apt-get Commands: Install A Package

In the case of installing a new package on Ubuntu, we can see that the apt-get install command does not show any progress status bar at the bottom of the terminal. But, while we use the apt install command to install an app, a progress bar appears at the bottom of the terminal to show how many more minutes it will need to finalize the installation.

For instance, we can see that the progress bar is showing the job status when I tried to remove Apache Cassandra from my system. 

see progress bar in apt remove

The apt and apt-get commands are not only used for an update or install a tool, they also can play role in removal, distribution upgrading, and others. When we run an apt update command, it actually does not install any new packages, it just updates the package repository from various servers.

If you look closely at the terminal screen after running an apt-update command, you will see that it has three types of ongoing processes; which are Hit, Ing, and Get. The term Hit means that the existing package repository remains the same as it was. The Ing means that the tool is ignoring the package repository for updating. And, the Get means that the package repository for this application is updating.

The apt command also displays how much data the application is using and how much hard drive space does it require for a package installation.

3. apt vs apt-get Commands: What Is The Difference?

We can see more significant differences between the apt vs apt-get commands when we try to update the cache files. Earlier, Ubuntu and other Debian-based Linux distributions started using the Advanced Packaging Tool (APT) for managing packages.

Please note that the APT and the apt are not the same. In Ubuntu, there are various package management tools that support the Advanced Packaging Tool (APT). And, the apt-get was one of those commands that could function with the APT tool.

To solve the apt vs apt-get commands dilemma, we have got the apt command. The apt command originally works with the fundamentals of the apt-get and the apt-cache commands. But, the apt command is not conventional, it eliminates all the complexity that we face on the apt-get command.

In Linux, the new apt command actually is helpful. It gathers all the necessary tools in a place so you don’t need to worry about so many functional commands like apt-get.

4. apt vs apt-get Commands: Which Do We Need to Use?

As we have seen that in most cases the apt command replaces the apt-get command, so the question which is wandering in your head might be, so will the apt-get command be discontinued?

Well, the answer is not. Because there are some specific packages and tools that only function with the apt-get command. These low-level functional works and those commands that do not require compiling will be using the apt-get command.

5. Use Case of apt vs apt-get Commands

The most believable explanation and concept for using the apt command on Linux are that it can do the work of both apt-get and the apt-update. In addition, the apt command is also capable to install packages on the system with the functionalities of the Debian package manager daemon, which means that in some cases, apt can handle the dpkg -i command as well.

Case 1: Install, Update, And Remove Commands

However, here we have listed a few most used apt and apt-get commands. I am also explaining which command does what.

For instance, both of the below-mentioned apt and apt-get commands can install a package on Linux. But the way of connecting to the server and pulling data from the repository is different. Please have a look at all the listed commands for a better understanding.

Update the system repository and reload the system settings.

apt update 
apt-get update

Both apt and apt-get can install packages on Linux.

apt install 
apt-get install

For removing packages on Ubuntu, you can use any of the below-mentioned apt or apt-get commands.

apt remove 
apt-get remove

In Linux, the purge command removes the broken package and wipes the configuration settings. However, use the following apt and apt-get commands to purge a package.

apt purge
apt-get purge

Case 2: Upgrade, Auto-Remove, And Cache Commands

The following apt and apt-get commands will let you upgrade the installed packages that are upgradable.

apt upgrade 
apt-get upgrade

In Linux, the auto-remove command removes those and wipes up those files that are no longer in use. The auto-remove commands sometimes free up some drive space and make the system faster. The below-mentioned apt and apt-get commands can perform the auto removal process.

apt autoremove 
apt-get autoremove

apt get auto remove

Both of the apt and apt-get commands can upgrade the distribution if any newer version is available. In Ubuntu, you can do the distribution upgrade with both apt, apt-get commands, and with the APT GUI tool.

apt full-upgrade 
apt-get dist-upgrade

To see the details of a package, run any of the apt or apt-get commands on your shell.

apt show 
apt-cache show

6. Dedicated apt Command

So far we have gone through a few similar commands that are available for both apt and apt-get. As using the apt is more hassle-free, the developers have made a few commands that are only available for apt not for apt-get.

You can have a look at the following two commands to get a better understanding. The below-mentioned apt commands will display the list of packages with the current status.

apt list

apt list on LInux

Since Ubuntu and other Debian distributions use a few repository servers for installing packages, sometimes if you need to do some advanced level package management. You might need to edit the repository server list for some operations.

The below-mentioned apt command will let you edit the package source to add, remove the repository list. Please be careful while executing the command, any incorrect edit in the repository source may break your system.

apt edit-sources

apt edit-sources

Final Words

Giving a fancy answer for the difference between apt and apt-get was not our aim; we have gone through the in-depth explanation for apt and apt-get commands on Linux. If you’re a new Linux user, I would recommend you to try the apt command as it is hassle-free. In the entire post, we have seen the difference between apt vs apt-get commands. 

Please share it with your friends and the Linux community if you find this post useful and informative. You can also write down your opinions regarding this post in the comment section.

Jahid Onik
Jahid Onik
He has completed his Electrical and Electronic Engineering graduation from a well-reputed University. He has been working as a data analyst for the past few years. He has been using Ubuntu since 2014.


Please enter your comment!
Please enter your name here

Latest Post

Must Read