[Guide] apt vs apt-get commands, and which one to use?

Linux users, both veterans, and newbies, often get confused about the difference between commands apt, and apt-get. This guide defines each of these commands.

Many Linux users, both veterans, and newbies, often get confused about what the difference between the Linux commands apt, and apt-get are and when they should use one or the other.

A Brief History of the Advanced Packaging Tool (APT)

Debian introduced the apt command in 2014. However, most users were not aware of the new command, opting for the more familiar and reliable apt-get. The apt command did not garner recognition or widespread use until the release of Ubuntu 16.04 in 2016.

Soon after that release, the prevalence of the apt command rather than the traditional apt-get command in Ubuntu 16.04 documentation, how-to articles, and websites prompted other Debian- and Ubuntu-based distros to follow suit and encourage their users to use the apt rather than apt-get command.

Before we get too in-depth with the differences between apt and apt-get, lets first discuss what APT is and why Debian developed it.

When the Debian distribution initially released, a set of tools was necessary to manage the package system. This prompted the development of the Advanced Packaging Tool (APT).  APT is just the front-end to dpkg, Debian’s package management software.  Please don’t confuse the apt command with APT. The two are not the same.

APT is an open-source command-line tool that works with the Linux core libraries to handle the installation, configuration, and removal of packages on Debian, Ubuntu, and other Debian/Ubuntu-related Linux distros.

When APT became available, apt-get was one of the main command-line tools included.  Another oft-used command-line tool was apt-cache, and for successful installation or removal of a package, you had to use both in conjunction.  This was often clunky, cumbersome, and sometimes confusing for the user.  Plus, it was just downright ugly.  Enter the apt command.

The apt Manpage originally stated that the command was meant to be “pleasant for end-users.” It has been since updated to read:

“It is intended as an end-user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).”

apt command replacements for apt-get commands

apt CommandCommand It ReplacesFunction of Command
apt installapt-get installInstall a package.
apt removeapt-get removeRemove package.
apt purgeapt-get purgeRemove package and configuration.
apt updateapt-get updateRefresh repository index.
apt upgradeapt-get upgradeUpgrade all upgradeable packages.
apt autoremoveapt-get autoremoveRemove unwanted packages.
apt full-upgradeapt-get dist-upgradeUpgrade package & auto-handle dependencies.
apt searchapt-cache searchSearch for a packages.
apt showapt-cache showShow package details.

apt, in addition to the replacement commands above, also adds two new commands that the apt man page lists as “work-in-progress.”  These two are:

  • apt list – List packages with criteria (installed, all available, upgradeable)
  • apt edit-sources – Edits the sources.list file in the preferred editor

apt vs. apt-get: know the differences

The best way to show the difference between the apt and the apt-get commands is to see in action.  To do this, we will install Kazam, one of the best and easiest to use screen recorders for Linux using both commands.

Let’s try apt-get first.

# sudo apt-get install kazam

While the installation with apt-get is straightforward, and we see the package and the dependency packages being installed, we have no clue how long the installation will run.

Now let’s install Kazam with the apt command.

# sudo apt install kazam

With the apt command, not only do we see Kazam and all the dependent applications being installed, but we’re presented a nice progress bar at the bottom of the terminal window, letting us know the progress of is installation. Much better, isn’t it?

We could have achieved the same results with apt-get and some additional command options. But why bother, apt has them built-in.

Conclusion

So, what should you use, apt or apt-get?  Unless there is a compelling reason not to, always opt for the apt command. It combines the most commonly used commands from apt-get and apt-cache with much less fuss.

The only logical reason to use the apt-get and related commands is if you are using them in a bash script. These commands are lower-level, considered “back-end,” and are most often used to support APT-based packages such as Synaptic, aptitude, and the Ubuntu Update Manager.

Dedicated users of the apt-get and apt-cache commands should not be discouraged, however. Debian has no plans to deprecate the apt-get or apt-cache commands, as both are vital in creating APT-based packages. And while it’s recommended that you use the apt, it’s not a requirement.  apt-get will work just fine.

The apt command, conversely, is specially designed for use by the end-user.  It’s friendlier, tidier, and fancier. This was clear in our example. Plus, that progress bar is pretty cool!

We encourage you to check out the various options of both commands via

# man apt-get

and

# man apt

Please let us know your experience with the commands, as well as your preferred command and why.

Travis Rose
Hi, I'm M Travis Rose, a contributor to FOSS Linux. I have over thirty years of experience in the IT arena, at least fifteen of which has been working with Linux. I enjoy converting existing Windows users to the wonderful world of Linux. I guess you could call me a Linux-evangelist. Long live Linux!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,521FansLike
364FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

How to setup FTP Server on CentOS

You are allowed to use any one of the FTP servers as you like. However, in this tutorial, we will be installing and using vsftpd, short for Very Secure FTP Daemon. It is a fast, stable, and secure FTP server that will help you transfer files to and from a remote system in a jiffy.

CentOS Vs. Ubuntu Server : Everything You Need to Know

Choosing the perfect Linux distribution to set up your server can be confusing since Linux provides a limitless number of options. The main reason behind these many distributions is because Linux is an opensource platform. Anybody with the required skills can contribute to the development or build and release their distribution. Currently, there are more than 600 Linux Desktop and Server distributions in the market.

Top 10 Reasons to use Xfce as your Desktop Environment

There are many choices for desktop environments for Linux based operating systems. Mainly, you can install any DE of your choice on most of the Linux based distributions, even if they are not offered as a package officially. In our recent articles, we discussed the best of KDE and Cinnamon. In this article, we wish to present to you the top reasons why you should consider Xfce as your desktop environment.

The 10 Best Linux Network Monitoring Tools

Having total control over your network is essential to prevent programs from overusing your network resources and slowing down the overall performance. This is why you should install a network monitoring tool on your system, giving you a visual overview of everything that's happening on your network. Networking Tools are like swiss-knife for the system administrators for troubleshooting system issues.

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

Top 5 reasons to switch from Windows to Linux right now

Do you love Windows or Linux? Being on a Linux website, it's not hard to take a guess, but what are the strong reasons to switch to Linux? Linux is a 100% free OS. Is that reason alone enough? Let's find out! Never have there been more compelling reasons to make the switch. Here are just five great reasons for users to create that magical move from the wayward world of Windows to the lauded land of Linux.

Beaker Browser: A P2P web browser you must try

I think we can all agree on the fact that the web browser is an integral part of our Linux systems, or any computer system, for that matter. We have had several fulfilling options for browsing the web, like Firefox, Brave, Vivaldi, Tor, etc. and they have worked pretty well, but also pretty much in the same way, except for Tor, which is much better for anonymity.

10 Best Video Editing Software for Linux

This article is for all the Linux users out there who are looking for video editors to create their own professional videos, which can range from short documentaries to even movies.

5 Best Download Managers for Linux

We often need to download large files that can go corrupt due to various reasons such as slow internet or interrupted download. Using a broken downloaded file is not something one wants. Download managers make sure that the downloaded file maintains its integrity and also presents you with the ability to pause and resume downloads, provided the server supports it. When you are downloading a massive file, it's recommended to use a download manager.