apt vs apt-get – Advanced Package Tool

If you’ve ever used Debian Linux or one of the many Linux distributions that were derived from it, such as Ubuntu, you may have seen the apt and apt-get commands sprinkled throughout the distro’s documentation.

At surface level, these commands seem interchangeable, and a lot of documentation or online guides throw them around as if they are. However, there are some key differences between the two and we have some recommendations about which one you should be using. In this guide, we’ll explain the differences and give some examples for both commands. Read on to learn about the specific uses for each command and which one is better for you to use.

In this tutorial you will learn:

  • What distros use apt and apt-get?
  • What is the difference between apt and apt-get?
  • Command examples for apt and apt-get

apt vs apt-get

apt vs apt-get

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian Linux and most derivatives
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

What distros use apt and apt-get?

Debian and Ubuntu are probably the most notable Linux distros that use APT (Advanced Package Tool) software which contains the apt and apt-get commands, among others, that you are used to seeing. There are a lot of other distros that are based on Debian, and most of those also use APT.

When describing the differences between these two commands, mileage may vary depending on which distro you’re using. For example, Linux Mint has its own variation of the apt command, which is actually just a wrapper that utilizes apt-get and includes some additional functionality. Other distro developers may come up with their own tweaks, so when we’re discussing apt and apt-get in this article, we’re specifically talking about its implementation on Debian and Ubuntu.



What is the difference between apt and apt-get?

To put it simply, apt is the command meant for the Linux user, and apt-get is the command meant for system use. In technical terms, this means that apt provides a high level interface for package management and apt-get provides a low level interface.

The two commands basically perform the same functions, but apt is easier to use and has some user friendly features, like a status bar to show the progress as packages are installed. Since apt is designed for a Linux user, it doesn’t cause much fuss when developers update it or introduce their own implementations of it. Only the user is affected. On the other hand, apt-get receives fewer updates and needs to remain backward compatible. System functions and scripts rely on the predictability of apt-get.

So, that explains why both commands are necessary. Confusion arises because the commands look and function mostly the same, and apt was only introduced on Ubuntu in 2014. You’ll still find old documentation and guides that tell the user to execute apt-get commands to install packages, since that’s what was used. Furthermore, some users from back then are still stuck in that habit and may not have migrated over to using apt.

As an average Linux user, you should use apt when you’re installing packages or updating your system, etc. If you’re a developer, apt-get is what you’ll use in the scripts or programs you create.

Using the apt command on Ubuntu, a Debian based system

Using the apt command on Ubuntu, a Debian based system

Command examples for apt and apt-get

As you can see from the table below, the two commands mostly do the same thing but have a slightly different syntax. apt combines the functions from both apt-get and apt-cache, as well as providing a more convenient user interface and additional command line options.

apt apt-get / apt-cache Description
apt install apt-get install Install a package
apt update apt-get update Update all repository info
apt upgrade apt-get upgrade Update all installed packages
apt autoremove apt-get autoremove Remove packages that are no longer needed
apt remove apt-get remove Remove an installed package
apt purge apt-get purge Remove an installed package and delete configuration files
apt search apt-cache search Seach repositories for a package
apt show apt-cache show Show details for a package

These are just the most common ones. You can see more by checking the man pages for each command:



$ man apt
AND
$ man apt-get

Since apt-get is required to remain backward compatible and predictable, the commands above will likely never change. On the other hand, apt is continually developed. New options or changes may occur to apt in the future, especially as different distros add their own changes to it.

Closing Thoughts

In this guide, we learned about the differences between apt and apt-get. To summarize, apt is the user-side replacement for apt-get. Both commands are relevant and will continue to exist, since one is ideal for high level functions and the other one for low level.