What is the difference between apt and apt-get command?

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Introduction

If you are a Linux user, certainly you know apt and apt-get commands and most probably used it for managing packages in their system.

Both are open-source command-line tools that 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.

APT

Advanced Package Tool, or APT, is a free-softwareuser interface that works with core libraries to handle the installation and removal of software on Debian, and Debian-based Linux distributions.

APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packs, either from recompile files or by compiling source code.

Usage of APT

APT is a collection of tools distributed in a package named apt. A significant part of APT defined in a C++ library of functions;

APT also includes command-line programs for dealing with packages, which use the library. Three such programs are aptapt-get and apt-cache.

The apt package is of “important” priority in all current Debian releases, and is therefore included in a default Debian installation. APT can be considered a front-end to dpkg, friendlier than the older dselect front-end. While dpkg performs actions on individual packages, APT manages relations (especially dependencies) between them, as well as sourcing and management of higher-level versioning decisions (release tracking and version pinning).

A major feature of APT is the way it calls dpkg

It does topological sorting of the list of packages to be installed or removed and calls dpkg in the best possible sequence. In some cases, it utilizes the –force options of dpkg. However, it only does this when it is unable to calculate how to avoid the reason dpkg requires the action to be forced.

Difference between apt-get and apt

Firstly, you have to know the difference between apt and apt-get is the command itself.

For Example, if you want to use apt-get to update system, you have to run

sudo apt-get update

With apt, you have to run

sudo apt update

NOTE: 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.

Also to view the commands with apt, you can type apt help or visit the apt man page It will display all the information related to apt.

apt help
OR
man apt

Some types of apt and apt-get commands

  • To install package
apt install [package_name]
apt-get install [package_name]
  • To remove Package
apt remove [package_name] 
apt-get remove [package_name]
  • Also to Update all packs
apt upgrade
apt-get upgrade
  • Also to Search packages
apt search
apt-cache search
  • Update all packages and handling of their dependencies
apt full-upgrade
apt-get dist-upgrade
  • Show package information
apt show
apt-cache show
  • Remove unwanted dependencies
apt autoremove
apt-get autoremove
  • Removes package with associated configuration
apt purge
apt-get purge

NOTE: The apt show command prints the output in alphabetical order and hides some less important information that shown by the apt-cache show command.

There is another feature of the new apt command to make it pleasant for end users.

When the 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 as shown below in the screenshot.

The same with removing or purging a package.

If you run apt list –upgradable, this will display some colors to provide an obvious overview of the packages.

apt list --upgradable

There are two commands introduced with the apt:

Commands apt list & 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.
  • And apt edit-sources : when this command used, it opens the sources.list file in an editor for editing.

For the first command, we showed an example

For the second command, we will show you an example for it

sudo apt edit-sources

Choose the text editor you prefer

Conclusion

That’s it

We illustrated the difference between apt and apt-get command.

Thanks

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
MQ-Jr
MQ-Jr
unixcop Admin

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook