Photo by VFS Digital Design / CC BY 2.0 | Modified from original.
If you're a Debian (or Ubuntu) Linux user you can probably use the simpler 'apt'-command and forget about 'apt-get', 'apt-cache' and 'dpkg'.
Managing installed packages is a core *nix-user skill. If you use Debian (or a Debian-derived Linux distro like Ubuntu) on servers you are probably familiar with apt-get
, apt-cache
and dpkg
; or perhaps you have given in and turned to the text-ui of aptitude
. APT, a tool that was originally released in 1998(!), got to version 1.0 in 2014(!!) and with the 1.0 release came a set of simpler commands for managing packages.
While it takes a little while for new versions of software to update in distros, it seems like it takes a lot longer for obsolete guides to APT to be pushed out of the top spots in the search engines. Of course you can still use the lower level tools (apt-get
, apt-cache
or even dpkg
), but apt
is probably easier in most cases.
So let’s get to the good stuff, here are the new apt
-commands you need the most:
apt search <terms>
– search for packages, e.gapt search zsh shell
apt list <pkg> \[--installed\] \[--upgradable\] \[--all-versions\]
– list packages, optionally installed, outdated or with all versions available locally, e.g.apt list --upgradeable
orapt list apache2 --all-versions
apt show <pkg> \[--all-versions\]
– show package information, e.gapt show apache2
apt install <pkg> \[\{=pkg_version_number | /target_release\}\]
– to install packages, optionally a specific version or release (e gtesting
orstable
), e.g,apt install zsh/stable
apt edit-sources
– simple way to get to edit your sources.listapt update
– update package index files from sources (e.g afterapt edit-sources
)apt upgrade
– upgrade all installed packages to their latest versionsapt full-upgrade
– do a smart upgrade of packages, taking dependencies into account (might remove dependencies)apt remove <pkg>
– remove package (but not configuration files), e.gapt remove apt-doc
Happy apt-ing!