What is APT Package Manager

Linux TLDR
Last Updated:
Reading time: 2 minutes

APT package manager is a built-in command-line tool for Debian-based distributions like Ubuntu to handle your applications by searching for them in the repository, listing them, installing them, updating them, removing them, etc., from your Linux system.

Tutorial Details

DescriptionAdvanced Packaging Tool
Difficulty LevelLow
Root or Sudo PrivilegesYes
OS CompatibilityDebian, Ubuntu, Linux Mint, Pop!_OS, etc.
PrerequisitesApt
Internet RequiredYes

Updating the Package Database

Execute the following command to update your system package database and get the latest package information:

$ sudo apt update

Upgrading System Packages

To update your whole installed package to their latest release:

$ sudo apt upgrade

Upgrading Specific Packages

If you have concern over upgrading your whole system, then specify the specific package name to upgrade.

$ sudo apt upgrade [PACKAGE_NAME]

Multiple packages can be upgraded simultaneously by separating each one of them with a space.

$ sudo apt upgrade [PACKAGE_ONE] [PACKAGE_TWO]

Full Upgrade your System

It is identical to the above two commands, except that it will remove the dependencies and packages that require removal and might cause a system crash in some cases.

$ sudo apt full-upgrade

Searching Packages

To install any packages, you need to first search for them in your Linux distribution repository by using the following command:

$ sudo apt search [PACKAGE_NAME]

Installing Packages

If you find your package available in your Linux distribution repository, you can install it using the following command:

$ sudo apt install [PACKAGE_NAME]

Multiple packages can be installed by separating them with a space.

$ sudo apt install [PACKAGE_ONE] [PACKAGE_TWO] [PACKAGE_THREE]

To install the package from its deb file, specify the full path of the package as shown below.

$ sudo apt install /path/to/file.deb

Removing Packages

Accidentally installed package or packages that are not required anymore can be easily removed using the following command:

$ sudo apt remove [PACKAGE_NAME]

Multiple packages can be removed by separating each with a space.

$ sudo apt remove [PACKAGE_ONE] [PACKAGE_TWO] [PACKAGE_THREE]

Removing Packages with Configuration

The “apt remove” command only removes the package without removing its configuration file. To remove them, use the “apt purge” command instead.

$ sudo apt purge [PACKAGE_NAME]

Multiple packages can be purged by separating each with a space.

$ sudo apt purge [PACKAGE_ONE] [PACKAGE_TWO] [PACKAGE_THREE]

Removing Unused Packages

One application is always dependent on multiple different applications; however, we always remove the first application but forget to remove its dependent application, which can be done using the following command:

$ sudo apt autoremove

Listing Local Packages

Issue the following command to list the installed and preinstalled packages on your Linux system:

$ sudo apt list

To filter out the specific package from the list of installed packages, use the command with grep:

$ sudo apt list | grep [PACKAGE_NAME]

Execute the following command to list only the manually installed applications:

$ sudo apt list --installed

Many applications require your attention to upgrade them; find out which one does using the following command:

$ sudo apt list --upgradeable

Display the Package Information

Execute the following command to find out the descriptive information related to the package, like its package maintainer, version, source, download size, dependencies depending on that package, and description.

$ sudo apt show [PACKAGE_NAME]

That’s all for now. If I forget to add something, let us know in the comment section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.