apt 1.0 - old dog with new tricks

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.g apt 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 or apt list apache2 --all-versions
  • apt show <pkg> \[--all-versions\] – show package information, e.g apt show apache2
  • apt install <pkg> \[\{=pkg_version_number | /target_release\}\] – to install packages, optionally a specific version or release (e g testing or stable), e.g, apt install zsh/stable
  • apt edit-sources – simple way to get to edit your sources.list
  • apt update – update package index files from sources (e.g after apt edit-sources)
  • apt upgrade – upgrade all installed packages to their latest versions
  • apt 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.g apt remove apt-doc

Happy apt-ing!