“apt update vs apt-get update” Differences Explained!

In this article, let us learn what differentiates the 2 very similar commands “apt update” and “apt-get update”.

In particular, we will try to answer the following questions in this article.

  • What is the difference in terms of functionality?
  • when to use apt update and when to use apt-get update?
  • what differentiates apt and apt-get?

For those of you who are in a hurry, here is the short version of the answer!

“apt update” vs “apt-get update”: In a Nutshell!

What is the difference between the commands “apt update” and “apt-get update“? Both these commands are used to download and update the package information from all of the configured sources, the difference is “apt-get” is old and is meant to be used with scripts while “apt” is newer and meant to be used in the command line interface.

The table below highlights their differences

You can remember which is which by thinking apt” is shorter to type as compared to “apt-get” and hence “apt” is more useful in the command-line interface where we have to type things manually every time!

Don’t worry if the above answer does not make sense to you as that was targeted at more experienced programmers who just wanted to refresh their memories. The rest of this article is dedicated to those of you in the first steps of your journey to becoming a Linux master!

So let us begin by having a little fun and uncover the true nature of the command line interface!

“apt update” vs “apt-get update”: A Thorough Explanation!

Before we could understand what these commands do, we must be able to answer the following question

How do commands work?

Here is a video we made to the answer to the question above!

Now that we have covered the fundamentals let’s get back to the topic!

What is the difference between apt and apt-get?

The apt and apt-get commands are both responsible for installation, removal, and updating of software in our system.

As we mentioned at the beginning of the article, the main difference between the 2 is that apt is the newer one, meant to make our lives easier in the CLI through fancy features like progress bars, the ability to get the same results with fewer keystrokes, etc.

If you have the thirst to learn even more, we have a dedicated article to this topic which you can find in the link below!

apt vs apt-get: Explained For Beginners!

Next let us move on to the question of focus in this article which is the difference between “apt update” and “apt-get update”

apt update vs apt-get update: Differences in Functionality

Let us experiment by giving the command “apt update” and have a look at the output.

Output: apt update

Now let us try the command “apt-get update” and see how this one’s output looks like

Output: apt-get update

As you can see both these commands match line by line till the line that says “Reading package lists… Done

After that the newer “apt update” command has the following 2 more lines

Building dependency tree        
Reading state information... Done 

As you might already know, typically, the “update” command is followed by the “upgrade” command.

In the “apt” command the “update” option does the job of “Building dependency tree” while in the “apt-get” command this job is given to the “upgrade” option.

Below is the output of the “apt-get upgrade” command.

output: apt-get upgrade

As you can see in the first 2 lines of “apt-get upgrade“, the jobs of “Building dependency tree” and “Reading state information… Done” are performed.

The “apt update” command ends by giving out the following clue to the user on what to do next.

16 packages can be upgraded. Run 'apt list --upgradable' to see them.

which basically means we can give the command “apt list –upgradable” to see the list of packages that can be upgraded to their newest versions.

Just like we mentioned in the table the “apt” commands are designed to be more user-friendly, hence this extra line of information!

While this section of the article covered the differences between these 2 commands, it did not cover them in depth. If you have the itch to learn about these 2 commands in-depth, we got articles on each of those commands which you can find in the links below!

“sudo apt update” Command Explained For Beginners!

“sudo apt-get update” Command Explained For Beginners!

Next let us see when to use which one!

When to use “apt update” and when to use “apt-get update”?

It is recommended to use apt commands on the terminal and apt-get on the bash scripts.

This is because “apt” being the newer version is constantly evolving and can sometimes break backward compatibility. For example, the commands that worked in version 1.7 of apt may or may not work in 2.0.

If we were to use apt on our scripts then we might need to edit our scripts time and time again with each new version. For this reason, the “apt-get” family of commands is preferred over “apt” as they have guaranteed backward compatibility.

Also apt-get family has more functionality for usage in scripts that will give the programmer more control over the required outcome.

You can read more about the differences between apt and apt-get in the article below, where we have explored their differences in great detail!

apt vs apt-get: Explained For Beginners!

Before we end this article, let us look at a pro tip that can be very useful as you get more experienced with Linux!

Where to get more information about these commands?

Is there a better way to quickly remind yourself of what a given command means without going onto the internet?

The answer is yes, it is possible and the best way to do this is by using the man command on the CLI!

man stands for manual and is used to get information about a given command along with the options and arguments the command supports. For example for our command “apt” try entering the following command on your terminal.

man apt

and you will get something similar to the screenshot below

Note: To scroll this page, you can use the Enter button to go one line at a time, or you can use the space-bar to go one page at a time. If you wish to close this and get back to the terminal, just press the key Q

Let us see if what we just learned is there on the man page for the apt command.

As shown in the screenshot above, if you have a look under the Description sub-heading, you will see the following lines.

apt

apt provides a high-level commandline interface for the package management system. 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 man page

update

update is used to download package information from all configured sources. Other commands operate on this data to e.g. perform package upgrades or search in and display details about all packages available for installation.

apt man page

Similarly by typing “man apt-get” you can look at the information about the apt-get command too from your command line!

As you can see, we can get the needed information from within the Linux CLI! This is one of the many features of CLI that is very useful especially when you know what command to use but you don’t know what option to use with the command to achieve what you desire!

These man pages can get a bit too “technical” for beginners, but trust me after a few weeks, this will feel like second nature to you, till then you can always read articles in websites like ours!

Alright, I will stop here, hope you have enjoyed reading this article and found this article useful!

Feel free to share it with your friends and colleagues!

If your thirst for knowledge hasn’t been quenched yet, here are some of our other articles that might interest you!

Related Articles

A Step By Step Plan To Learn Linux The Fun Way..!

apt & apt-get Explained For Beginners!

DNF vs APT: Similarities and Differences Analyzed!

Photo of author
Editor
Balaji Gunasekaran
Balaji Gunasekaran is a Senior Software Engineer with a Master of Science degree in Mechatronics and a bachelor’s degree in Electrical and Electronics Engineering. He loves to write about tech and has written more than 300 articles. He has also published the book “Cracking the Embedded Software Engineering Interview”. You can follow him on LinkedIn