Advanced Packaging Tool (APT)
APT is a comprehensive package manager which comprises multiple command-line directives that facilitate the installation and
management of software packages sourced from the repositories of
Debian and derivative Linux distributions.
The APT package manager requires a Linux terminal for the manual entry and subsequent execution of each command option. If you prefer a graphical
interface for APT, see the link below for usage of the Synaptic Package Manager.
Common APT Commands
Update database of available packages
• apt update
Updates local list of packages available at source repositories
Upgrade installed packages
• apt upgrade
Upgrades to available packages that are more recent than those currently
installed. Please note, apt upgrade will only update user-installed packages.
Upgrades of preinstalled packages are (intentionally) disabled using the
apt-mark hold option to avoid updates that may overwrite Puppy-specific
versions of applications. Consequently, a system-wide upgrade of binary
packages (if necessary) requires the periodic release of a distro-update
generated by Woof-CE. Alternatively, the user may search the repositories
for a specific package, then manually download and install.
Install new package
• apt install package name
Auto-completion: if uncertain about exact package name, type a few
letters and press tab key (x2)
Install multiple packages
• apt install package1 package2 package3
Reinstall same version of package
• apt reinstall package name
Install specific package version
• apt install package name=version
Install package including all recommended (optional) sub-packages
• apt install --install-recommends package name
Remove installed package
• apt remove package name
Removes binaries of package but retains configuration files
Purge installed package
• apt purge package name
Removes binaries and configuration files of package
Autoremove package dependencies
• apt autoremove
Removes prior dependencies of packages that are now removed
This command may not remove package dependencies that are also listed as extra (suggested) dependencies of another installed package. In this scenario, the following command will force removal of the optional dependencies:
• apt-get autoremove -o APT::Autoremove::SuggestsImportant=0
To make autoremove do this by default:
• echo 'APT::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/99nosuggests
Search for package
• apt search search term
Show contents of package
• apt show package name
Shows package contents, size, source, dependencies
List installed packages
• apt list --installed
List packages with newer available versions
• apt list --upgradable
Lists packages that have available versions more recent than those currently installed.
Download packages without installing
• apt clean
• apt update && apt install --download-only package-name
The above commands will clear the APT cache of all packages previously downloaded, then
update the current local package list and download the designated package and requisite
dependencies to the APT cache (/var/cache/apt/archives).
APT vs APT-GET
The
apt and
apt-get commands are similar but there are important differences.
For example, after apt installs packages the source deb archives are automatically removed.
Conversely, after packages are installed by apt-get (or Synaptic) the source deb archives
are retained in the download cache folder: /var/cache/apt/archives. To remove these cached
archives we can use apt commands as described above, or the apt-get commands as follows:
• apt-get clean (erase downloaded archive files)
• apt-get autoclean (erase old downloaded archive files)
• apt-get autoremove --purge (automatically remove all unused packages and config files)
When finished with APT package management the above command directives will remove residual
source archives, unused dependencies and transient cache files no longer required.
APT Manual
Here you will find more information about APT usage:
https://manpages.debian.org/testing/apt/apt.8.en.html
Synaptic Manual
Here you will find more information about Synaptic usage:
file:///usr/share/synaptic/html/index.html