APT package management tool in Debian Linux distribution
apt-get command is the APT package management tool in the Debian Linux distribution. All Debian-based distributions use this package management system. The deb package can package the files of an application together, roughly like the installation files on Windows.
apt-get [OPTION] PACKAGE
apt-get install # Install new packages
apt-get remove # Uninstall installed packages (keep configuration files)
apt-get purge # Uninstall installed packages (delete configuration files)
apt-get update # Update package list
apt-get upgrade # Update all installed packages
apt-get autoremove # Uninstall unnecessary package dependencies
apt-get dist-upgrade # Automatically handle dependency package upgrades
apt-get autoclean # Delete the .deb installation file of the deleted software package from the hard disk
apt-get clean # Delete the installation package of the software package
-c: Specify the configuration file.
The first step in using the apt-get command is to introduce the necessary software libraries. Debian's software library is a collection of all Debian software packages, which are stored on some public sites on the Internet. Add their addresses, and apt-get can search for the software we want. /etc/apt/sources.list is the configuration file that stores these address lists. Its format is as follows:
deb web or [ftp address] [distribution name] main/contrib/non-[free]
The Ubuntu we commonly use is a Debian-based distribution. We use the apt-get command to obtain this list. The following are the commonly used commands I compiled:
Run this command after modifying /etc/apt/sources.list
or /etc/apt/preferences
. Additionally you need to run this command periodically to ensure your package list is up to date:
apt-get update
Install a new package:
apt-get install packagename
Uninstall an installed package (leaving configuration files):
apt-get remove packagename
Uninstall an installed package (remove configuration files):
apt-get –purge remove packagename
All installed or uninstalled software will be backed up on the hard disk, so if you need space, you can use this command to delete the software you have deleted:
apt-get autoclean apt
This command will also delete the backup of the installed software, but this will not affect the use of the software:
apt-get clean
Update all installed packages:
apt-get upgrade
Upgrade the system to the new version:
apt-get dist-upgrade
Run this command regularly to clear out .deb files of uninstalled packages. This way you can free up a lot of disk space. If your needs are very urgent, you can use apt-get clean
to free up more space. This command will delete the .deb files of the installed software packages together. In most cases you won't be using these .debs files again, so if you're struggling with low disk space, this might be worth a try:
apt-get autoclean