The apt-get command in Debian 12 is used to manage the packages. As it is known that Debian comes with hundreds of packages of different software including Apache, Chrome, and VIM. To manage these packages, different package managers are used.
The apt-get is the command utility of the Advanced Package Tool (apt) which is used to manage the packages including their installation and removal from the computer. In this article, we will go through the usage methods of the apt-get command in Debian 12 with some simple examples.
What is the apt-get in Debian 12?
The apt-get is the command that is used to install, update, search, and delete the packages from Debian 12. The apt-get and apt-cache are all part of the Advanced Packages Tools, but they are becoming less popular.
The apt command is being much popular in Debian-based distributions because it can fulfill all the functionalities of the other commands including apt-get.
What is the General Usage Syntax of the apt-get Command?
$ sudo apt-get [options] [command] [package name]
The apt-get command can be used in Debian-based Linux distributions by following the general syntax:
The explanation of the above basic usage syntax of the apt-get command:
- Use the superuser privilege by using the sudo
- Invoke the package manager by typing the “apt-get” phrase
- Define different options of the apt-get according to the desired function
- Specify the command which is supposed to do
- Name the package which is supposed to be managed
What are the Basic apt-get Commands in Debian 12?
The basic and common apt-get commands, which should be known to every Debian user are explained below.
Update Package Using the apt-get Command
To update the package available in the Debian 12 database from its official repository using the apt-get command:
$ sudo apt-get update
Upgrade the Packages Using the apt-get Command
After getting the updates of the Debian packages, install these updates using the apt-get command:
$ sudo apt-get upgrade
Install Packages Using the apt-get Command
If the Debian user is going to install the packages with the apt-get command, then use the “install” option of the apt-get command. For example, to install the package of the VIM software on Debian 12 use the apt-get command:
$ sudo apt-get install vim
Install Packages Without Upgrade Using the apt-get Command
Another way to install the packages on Debian 12 is with the apt-get command without upgrading. To do so, use the “–no-upgrade” option of the apt-get command:
$ sudo apt-get install vim --no-upgrade
Upgrade the Installed Package Using the apt-get Command
To upgrade the particular installed package on Debian 12, use the apt-get command:
$ sudo apt-get install vim --only-upgrade
Check the Broken Dependencies
To diagnose the broken dependencies of any package using the apt-get command:
$ sudo apt-get check
Resolve Broken Dependencies Using the apt-get Command
Sometimes the packages are installed with broken dependencies. To fix these broken dependencies using the apt-get command, use its “f” option and complete the installation:
$ sudo apt-get -f install
Remove Packages (without their configuration files) Using the apt-get Command
To remove the packages which are no longer needed, use the “remove” option of the apt-get command:
$ sudo apt-get remove vim
Remove Packages (with their configuration files) Using the apt-get Command
If the package is supposed to remove all its configuration files, then use the “purge” option of the apt-get command:
$ sudo apt-get purge vim
Remove Unused Package Using the apt-get Command
For removing the packages which are not used for a long time, use the “auto-remove” option of the apt-get command:
$ sudo apt-get auto-remove
Clean the Cache Using the apt-get Command
One can free up the memory by clearing the cache using the apt-get command:
$ sudo apt-get clean
Upgrade to the New Debian Release
If the new version of Debian has been released, then upgrade to it using the “dist-upgrade” option of the apt-get command:
$ sudo apt-get dist-upgrade
Display the Help Documentation of the apt-get Command
To display the help documentation of the apt-get command, run the command:
$ sudo apt-get help
Open the Manual of apt-get Command
To explore more information about the apt-get command, one can access its manual using the command:
$ man apt-get
These are all about the usage of the apt-get command in Debian 12 for package management.
To use the apt-get command for managing the packages, follow its general syntax “sudo apt-get [options] [command] [package name]” on Debian 12. This usage of the apt-get command has been demonstrated with its basic commands in this blog. Different options are used to explain the usage of the apt-get command.