Apt and Apt-get - Which One to Use

Channel: Linux
Abstract: a progress bar has been introduced at the bottom of the terminal indicating the progress of the package upgrade process. 3) Additional commands with a

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

Firewall Vs Antivirus | Key Differe...

To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video

Firewall Vs Antivirus | Key Differences Between Firewall and Antivirus (2021) 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.

Operationapt-getaptUpdate package listsapt-get updateapt updateInstall a packageapt-get install package-nameapt install package-nameRemove a packageapt-get remove package-nameapt remove package-nameUpgrade packagesapt-get upgradeapt upgradeSearch packagesapt-cache search package-nameapt search package-nameDisplay package infoapt-cache show package-nameapt show package-nameRemove unwanted
packagesapt-get autoremoveapt autoremovePurge a package along
its config filesapt-get purgeapt 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.

Ref From: linoxide
Channels:

Related articles