In this complete guide article, you will learn about apt (Advanced Package Management Tool for Linux). You will learn all the necessary commands related to the apt package manager.

  • What is a package manager or package management tool?
  • What does it do?
  • How to use it?

If you have any such questions in your mind then this article will help you understand everything. So without any further let’s get into the apt guide.

What is a package manager?

A package manager is a tool that you use to manage the applications, libraries, and dependencies in your Linux distribution. It allows you to do all kind of package related modifications in the system such as:

  • Install or update packages
  • Remove or re-install packages
  • List or search the packages
  • Show package details
  • Download package files etc.

As Linux is very versatile, we have a lot of options for package managers:

  • – APT (Advanced Package Tool)
  • – DNF (Dandified Yum)
  • – Zypper
  • – Pacman
  • – Dpkg (Debian package)

However, APT is the most popular among them and it is being used by most of the popular Linux distributions like Ubuntu, Debian, Zorin OS, Mint Linux, Elementary OS, Bodhi Linux, MX Linux, Lite Linux, LUbuntu, POP! OS, Deepin, and the list of the distributions gone on-n-on.

So let’s see how to use apt-get related command to manage packages in a Linux distribution. We will go through the most helpful apt commands.

APT package manager commands

Here is the list of apt commands that you can use.

The ‘update’ command updates the repository for packages and get the update information related to packages:

sudo apt update

After updating the repositories in the system, you may want to update the package(s):

sudo apt upgrade package-name
sudo apt upgrade

To upgrade all the packages at once, just use ‘upgrade’ parameter with apt:

sudo apt upgrade

To install any package in the system use the ‘install’ parameter. You can install single and multiple packages at once.

sudo apt install package-name package-name

Same goes for removing the package(s), you can use ‘remove’ and ‘purge’. Again you can use either a single package or multiple packages at once.

sudo apt remove package-name

The difference between ‘purge’ and ‘remove’ is that with the remove it only deletes the package but not it’s configuration or data file. However, ‘purge’ command removes everything.

sudo apt purge package-name

You can search for a package in the repository with ‘apt search’:

sudo apt search name

Similarly, you can get all the details related to package/application in the repository with ‘apt show’:

sudo apt show package-name

Result of the above command:

$ sudo apt show neofetch

  Package: neofetch
  Version: 7.0.0-1
  Priority: optional
  Section: universe/utils
  Origin: Ubuntu
  Maintainer: Ubuntu Developers 
  Original-Maintainer: Nobuhiro Iwamatsu 
  Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  Installed-Size: 339 kB
  Recommends: chafa
  Homepage: https://github.com/dylanaraps/neofetch
  Task: lubuntu-desktop
  Download-Size: 77.5 kB
  APT-Manual-Installed: yes
  APT-Sources: http://archive.ubuntu.com/ubuntu focal/universe amd64 
  Packages
  Description: Shows Linux System Information with Distribution Logo
   Neoftech is a cross-platform and easy-to-use system information
   command line script that collects your Linux system information
   and display it on the terminal next to an image, it could be your
   distributions logo or any ascii art of your choice.

You can use ‘apt list’ to list the application and it’s available architecture(s):

sudo apt list package-name

Result of the above command:

sudo apt list package-name

  Listing... Done
  vlc/focal 3.0.9.2-1 amd64
  vlc/focal 3.0.9.2-1 i386

You can also download the package file (vlc.deb) with ‘apt download’:

sudo apt download package-name

For some reason you need to reinstall a package/application, you can do that with ‘apt reinstall’:

sudo apt reinstall package-name

The ‘autoremove’ is used to remove packages that were automatically installed to satisfy dependencies for other packages but now no longer needed as dependencies changed or the package(s) needing them were removed in the meantime.

sudo apt autoremove

You may find commands starting with ‘sudo apt install’ or ‘sudo apt-get install’ both work in the same way so if you do not feel like adding ‘-get’ with ‘apt’ then you can eliminate.

To tell you my secret I hardly use ‘-get’, please don’t let ‘apt’ know that. It’s secret.

Also check out: Installing applications in Linux | Complete guide

Watch Video guide on YouTube

Additionally, You can also watch a step-by-step video guide on YouTube to get a better understanding of it.

Conclusion

So that was it, about how to use ‘apt’ (Advanced package management tool) on Linux. Let me know what you think about it in the comment section below and don’t forget to subscribe to the LinuxH2O Youtube channel. Till then, keep enjoying Linux.