Quick Links

Key Takeaways

  • apt-get and apt are both tools within the Debian Package Management System.
  • apt-get is a full-featured interface to dpkg, while apt is a slightly stripped-back but more user-friendly version of apt-get.
  • apt and apt-get have some common commands, such as install, remove, purge, update, upgrade, and autoremove, but apt also includes additional commands like search, show, list, and edit-sources.

Why do Debian-based Linux distributions have apt as well as apt-get? Did apt replace apt-get or do they have different purposes? We explain the relationship between these two commands.

The Debian Package Management System

A major effort in creating a Linux distribution is designing and creating a package management system. Your users need to have a way to install and uninstall software packages. That requires software to retrieve the package files from your software repository and to install them correctly on the users' computers.

This is no small undertaking. Even putting the software engineering to one side, hosting the software repositories takes time, effort, and expense. That's one of the reasons so many "new" Linux distributions are derivations of an existing Linux distribution.

This leads to families or genealogies of Linux distributions, such as the Debian-based distributions, the Red Hat-based distributions, the Arch-based distributions, and so on.

The Debian family of distributions — including Ubuntu and all the Ubuntu-derived distributions — uses the Debian Package Manager. This uses package files with the ".deb" file extension, referred to as DEB files. DEB files are compressed files containing other archive files. The archive files contain the application's executable files, man pages, libraries, and so on.

Installing the software from a DEB file means unpacking all these component files and placing them in the correct locations on your computer. It also requires interacting with the operating system and the desktop environment so that the application shows up in application searches and its icon can be added to docks or system menus.

The apt-get and apt commands both do that. But why do we have two commands for the same thing?

The Chain of Command

The package that really performs the installation is called dpkg . It is actually a family of commands including dpkg-split , dpkg-trigger , and dpkg-divert . These are called, if and as required, by the tools in the Advanced Package Tool suite, or APT. APT is another collection of tools, including apt-get, apt-cache , and apt.

The dpkg command is considered a low-level command. Beyond the simplest of interactions, it becomes very complicated with a great many options. The apt-get command acts as a front end to the dpkg suite of commands. This simplifies matters considerably. apt-get is designed as a user-facing command and not a low-level background command. Even so, despite its human-facing role, another command called apt-cache was used to display information to the user.

The apt command provides another way to "talk" to dpkg through a more-accessible and user-friendly command-line tool. It provides a subset of the features of apt-get, but it is a large subset and it provides all the commonly used features and it also includes functionality from apt-cache .

Linux Mint needs a special mention here. The Linux Mint maintainers have developed their own version of apt, which is a Python wrapper for apt-get. That's not the apt we're talking about here. We're referring to the mainstream Debian apt, which was released in 2014, and gained attention and traction in the user-verse when it was included in Ubuntu 16.04 in 2016.

The Differences Between apt and apt-get

So, dpkg is the low-level background application. The apt-get command is a full-featured but simplified interface to dpkg , and apt is a more user-friendly but slightly stripped-back version of apt-get.

But apt-get and apt provide more than just an easy interface to dpkg . They do things that dpkg doesn't do. They will retrieve files from repositories and will try to assist with missing dependencies and conflicts.

In turn, the apt command does some things apt-get doesn't. It provides more information of the type the average user wants to see during an installation and suppresses some of the more obscure information that apt-get displays. apt gives superior visual feedback and uses color highlights and progress bars in the terminal window.

There are some common commands between apt and apt-get. All of these commands can be preceded by apt or apt-get and will behave the same:

  • install packagename: Install a package.
  • remove packagename: Remove (uninstall) a package.
  • purge packagename: Remove a package and its configuration files.
  • update packagename: Update the repository information.
  • upgrade: Update all packages.
  • autoremove: Remove libraries and other packages that are no longer required.

The apt full-upgrade option replaces the apt-get dist-upgrade option.

These are new commands for apt:

  • apt search: Search for a package name in the repositories. This is the same as apt-cache search
  • apt show: Show information about a package. This is the same as apt-cache show .
  • apt list option: Shows lists of installed or upgradeable packages.
  • apt edit-sources: Directly edits the list of repositories that apt searches in for packages.

Installing an Application with Apt

You can use apt search to see whether a package exists in the repositories or to check that you've got the right name for the package. Let's say you want to install Scribus but you don't know the package name. You might try looking for scribus-desktop .

apt search scribus-desktop

Searching the repositories for a package called scribus-desktop

That search didn't find anything. We'll try again with a shorter, more generic, search clue.

apt search scribus

Searching the repositories for a package called scribus

This returns several hits, and we can see that there is one called "scribus", and that it certainly looks like it is the core package for the Scribus desktop publishing application. The apt show command will give us more detail.

apt show scribus

Finding out more about the scribus package

We get a dump of information about the package, including what will be installed and a description of the software.

Information about the scribus package

It also suggests other packages that might be required, depending on our needs.

To install the package we need to use sudo.

sudo apt install scribus

Installing the scribus package

The files are retrieved from the repositories. The file currently being retrieved is highlighted in brown.

File retrieval as part of the installation of a package

When the files have been retrieved they are installed. The progress through the installation is shown as a percentage displayed in digits and as a progress bar.

The installation of the package with a highlgihted percentage and progress bar

Other Commands

The apt list and apt edit-sources commands are options in apt that don't exist in apt-get.

The apt list command can be used with the --installed or --upgradeable options to see the packages on your computer that are installed, and which ones could be upgraded.

To see the list of applications installed on your computer use:

apt list --installed

Listing installed applications

Scrolling through the output, we can see two entries for our newly installed Scribus application.

A list of the installed applications

To see if any of the installed applications can be upgraded, use the --upgradeable option.

apt list --upgradeable

A list of the applications that can be upgraded

The apt command also provides a way for you to edit the information stored about the repositories apt searches for packages. Only do this if you know what you're doing.

sudo apt edit-sources

Editing the repository information with apt

This command opens your default editor and loads the file holding the repository information.

Repository data file opened in the nano editor

Should I Use apt or apt-get?

The apt-get command isn't updated often, and that's a good thing. It has to maintain backward compatibility. Backward compatibility isn't such a concern for apt. It is considered and treated as a user-facing command.

For day-to-day use, use apt.

If you script anything to do with package installation, use apt-get. That gives you the greatest chance of portability and compatibility in your scripts.