Debian

How to Use apt Package Manager in Debian 12

Debian 12 is an open-source operating system that comes with a default package manager known as apt. APT is an acronym for Advanced Package Tool. It is a command-line tool that efficiently handles the software package management in Debian 12. This package manager handles the installation, configuration, and deletion of packages.

In this write-up, the method of using APT Package Manager is discussed.

How to Use apt Package Manager in Debian 12?

We can use the apt package manager for different purposes as described below:

How to Update the Packages Using apt?

Before installing or updating any package, it is recommended to update the package list using the command:

$ sudo apt update

In my case, all the packages are up to date:

How to Install the Packages List Using apt?

After updating the packages, we can install different types of packages using the apt command.

Let’s install a commonly used text editor nano, using the following command:

$ sudo apt install nano

This command installs the nano package along with its dependencies:

How to Uninstall the Packages List Using apt?

In order to delete a package use the “apt remove nano” command.

$ sudo apt remove nano

This command deletes the packages but it does not delete the configuration files. Press “Y” to continue with the installation process:

To delete the package as well as its configuration files, we use the command:

$ sudo apt purge nano

Press “Y” and after a few seconds, the nano package will be deleted successfully.

How to Upgrade the Packages Using apt?

In order to keep our system up-to-date with the security attributes, it is necessary to upgrade our packages. To upgrade, use the given command:

$ sudo apt upgrade

My packages have already been upgraded as shown below:

In order to upgrade the held-back packages, use the following command:

$ sudo apt dist-upgrade

How to Search for Packages Using APT?

We can also search for packages using the apt command. To search for packages that contain the keyword “firefox”, we use the following command.

$ apt search firefox

This command retrieved all the packages that contain the keyword “firefox”.

How to Install other Packages using apt?

Let’s install some packages that are not installed by default in Debian 12 such as “synaptic”. To install “synaptic”, use the following command:

$ sudo apt install synaptic

This command will execute and install the newest version:

Conclusion

“apt” is a powerful package manager command line tool that allows the user to perform different operations such as updating, upgrading, installation of packages, package deletion, etc. It is a convenient method to handle the packages in Debian 12. This write-up has illustrated how to use the “apt” package manager in Debian 12.

Similar Posts