apt, the Advanced Package Tool from the Debian project, is for managing packages by using a lot of separate tools to accomplish various tasks. In the past, users needed to know multiple command structures like apt-get, apt-cache, apt-config, and many more to utilize the full feature-set of apt.
Now, it’s straightforward and its commands are mostly selfexplaining:
update | obtain new package information from sources |
upgrade | upgrade to higher version, including new dependencies and new packages |
full-upgrade | alike upgrade, plus deletes packages |
install $package | installs from sources |
install /path/to/package.deb | installs local $package and its dependencies |
reinstall package | alias for install --reinstall |
remove $package | uninstalls $packagePAKETNAME |
purge $package | alike remove, plus deletes config files (not user related files) |
autoremove | deletes packages not longer dependencies |
search $string | shows packages that have $string in their name or description, even RegEx |
show $package | gives information on $package |
One can install from local packages. Note dot slash!
# apt install ./package.deb
Instead dpkg –get-selections | grep -v deinstall one can
$ apt apt list --installed
Configuration
To change default behaviour, apt uses an arcane system of configuration syntax.
By default, it installs recommended and suggested packages with every package one explicitely installs.
To avoid this, edit or touch a file /etc/apt/apt.conf:
APT::Install-Recommends "0";
APT::Install-Suggests "0";
apt can handle priorities which version of a package to install.
Priorites are expressed by numbers, where packages with
· <1 won’t be installed ever
· 1-99 will only be installed if no other version of that package is
installed already
· 100-499 will only be installed if no newer version of that
package is installed or available in another distribution already
· 500-989 will only be installed if no newer version of that
package is installed or available in that distribution already
· 990-1000 will only be installed if no newer version of that
package is installed
· >1000 will always be installed, even if it’s a downgrade.
apt reads priorities from any file in /etc/apt/preferences.d or /etc/apt/preferences:
Package: *
Pin: release a=testing
#Pin: release a=trixie
Pin-Priority: 900
Package: *
Pin: release o=Debian
Pin-Priority: -10
This reads as: Install every chosen package from the testing distribution, if no newer version is already installed. Do not install packages from other distributions.