In this article, let us learn about the command “apt update” and see how that differs from the command “apt-get update”
When I was a complete beginner and I needed to install something on my Ubuntu machine, I went online and typed in “How to install <software name> on Ubuntu” and sometimes it led me to a page with some commands which looked like this
sudo apt update
sudo apt install <software name>
While other times it led me to a page with some commands which looked like this
sudo apt-get update
sudo apt-get install <software name>
I was just happy that I was able to type something in the Terminal and that it actually worked and did what I wanted it to do! I did not pay much attention to what I actually typed in. I guess to beginners, it just feels like a magic spell to get something installed!
In this article, I have tried to explain what these commands mean and what their differences are. I have tried to stick to a beginner’s perspective avoiding unnecessary “technical terms” and I have also tried to keep this article concise so that you can get through the entire article in about 15 to 20 mins max!
Let us see what these commands do, why there are 2 versions of this update command, and when to use each!
For those of you in a hurry, here is the short version of the answer!
The Short Version of the Answer
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, more useful in scripts while the “apt” is newer and more useful in the command line interface.
Here is a table of comparisons for when to use “apt” and when to use “apt-get” for your package management needs.
Let’s take a look at a comparison of apt and apt-get.
apt | apt-get |
Newer version command to act as a front-end for APT | Older version command to act as a front end for APT |
More user friendly and has a progress bar | No progress bar, less user friendly as compared to “apt” command |
Has limited functionality | Has more functionality, and it’s used with bash-scripts more than apt because of guaranteed backward compatibility |
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!
Let us experiment by giving the command “apt update” and have a look at the output.

Now let us try the command “apt-get update” and see how this one’s output looks like
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
This is simply a matter of design change. You see, the “update” command is usually followed by the “upgrade” command (in most but not all cases). In the “apt” command the “update” sub-command does the job of “Building dependency tree” while in the “apt-get” command this job is given to the “upgrade” sub-command.
Let us see what I mean in action by taking a look at the command line “apt-get update“
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 executed.
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!
I can see that the above few paragraphs have too many “technical terms” (which I promised not to use!) but that is just the short version of the answer so do not worry if you don’t understand every word in that paragraph!
By the end of this article we will get back to this short answer version and by that time I am sure you will be able to understand what every word meant in the short answer above!
So let us begin by exploring what these commands do on the most basic level!
The Fundamentals
Before we could understand what these commands do, we must be able to answer the following question
How does commands work?
Here is a video we made to the answer to the question above!
Now that we have covered the fundamentals lets get back to the topic!
apt update vs apt-get update
Let us start by exploring the answer to the question “What does apt and apt-get do?“
The apt and apt-get commands are responsible for installation, removal, and updating of software in our system.
A good analogy is to think of your computer as a factory and any of these 2 commands as the manager in that factory who is responsible for the installation of new equipment, removal of equipment that is no longer needed, and update desired equipment to their latest versions, while maintaining records of the equipment names and versions which are currently present in the factory.
Since we have established the fact that these 2 commands are simply 2 ways to accomplish the same end goal, let us focus on the “apt update” command for the following few sections.
Let us take another look at the output of the “apt update” command.
Your output might look a bit different than mine, but the important things to note here are the “Hits“. All of these web addresses are repos that contain software. As you can see the last line says “Reading package lists… Done” which means that my computer went ahead and read all the available software in the repos and compared them with the version present on my end and found that they are up-to-date!
Continuing with our factory analogy, assume our manager is maintaining an excel sheet containing the list of parts available from various equipment manufacturers. Here using the sub-command update we are telling our manager to contact all the equipment manufacturers and get data regarding the latest available equipment and redo his excel sheet!
So in essence, what we are doing when we enter this “apt update” or “apt-get update“commands is we are asking our Linux machine to go browse these lists and copy the latest version of them and put them in our computers!
If you still have an “incomplete feeling” about what this command means, read on for a longer and even more informative answer where I explain the answers to the following questions
- Command Line Interface vs Graphical User Interface: What is the need to have these 2 interfaces?
- What is a command-line?
- Why do we need this command before we install software? and
- Where to get more information about these commands?
- What are the other differences between apt and apt-get commands?
So let us carry on with our exploration of the Linux world!
Let us start by exploring the world of text-based command line interface!
Command Line Interface vs Graphical User Interface
Let us first begin with this basic question of why use the command-line interface in the first place! Why not simply download and install an app instead?
As you might already know there are 2 types of ways for us to interact with the computers
- Through the Graphical User Interface, a.k.a GUI and
- Through the Command Line Interface, a.k.a CLI
But, what is an “Interface”?
Interface
Interfaces can be thought of as the middleman between you and the machine, a way to make the machine understand what your wishes are. A TV remote is a good example of an interface, as this device acts as a middleman between you(the human) and your TV(the machine). Using a remote you can interact with your television, hence your TV remote is an interface!
Graphical User Interface
The graphical user interface is the interface we are all familiar with, where we use our mouse or the touch screen to click through various icons and perform the desired action on our computers. This interface was made to make the operations on computers easier for regular users who might not be as tech-savy as programmers or software engineers.
Command Line Interface
Before GUI, in the computing world, the uses/applications of using a machine like a computer were very limited and there was another way to run programs on the computers, which is via the CLI. Through CLI, which is a text-only interface, specialists can run their desired programs.
There are several advantages of CLI compared to the GUI. The 3 main advantages of CLI are listed below
- since the CLI came first, this means GUI is still playing “catch-up” and this means you can do more things through the CLI than through the GUI
- CLI is very resource-efficient (most of what you pay for in terms of hardware like CPU, GPU, mouse, touch-pad, touch-screen are all made for the main purpose of running the GUI. Because of the resource efficiency, almost all of the webservers and cloud infrastructure are run via CLI without a GUI.
- Once you become a power user of Linux on the CLI, you can do a lot of fun projects which you never thought possible! This can include things like hosting your own website straight from your laptop, or tweak your old laptop to run as smoothly as a freshly bought one!
Now that we have established the fact that the command line interface is very useful, let us learn a few basics of the CLI.
Let us start by answering the question, ‘what is a command-line?’
What is a command-line?
A command-line is a line of text which tells our computer to perform a specific action.
As you might already know the words used in the text are specific for a given purpose and not some random text.
For example, a computer will understand the command-line “sudo apt install” and not “please install software“!
Unfortunately, our computers have not reached a state where we can just order the computer around the way we see robots are instructed in science fiction movies. We are getting there with natural language processing AI, but there is an awful lot of processing involved, which is very inefficient.
Due to this inefficiency, voice input is never going to replace the good old command-line interface when it comes to cloud computing and data centers. This is because in data-centers are very power-hungry and better efficiency translates into lower power consumption and lower running costs, which means more profit for the company!
Next let us see the basic structure of a command-line.
Command-Line Format
The command-line usually consists of the following 4 parts
- command
- sub-command
- options and
- arguments
Among these 3 parts, the command is mandatory. sub-command, options, and arguments are optional parts though you will need them in most command-lines!
Since we have established the fact that both these commands do essentially almost the same thing, let us keep our focus on just one of these commands the apt update command.
What do the 3 words in the command (sudo, apt, and update) mean?
Let us try to break the command line “sudo apt update” into its building blocks and try to figure out the meaning of each word.
As you can see in the above picture, the command-line “sudo apt update” in question contains the command named “apt” and the sub-command named “update” and we have no options or arguments in this command line.
The term sudo stands for “super-user do“. This term is used to get administrative privileges so that we can install and remove software from our computer. Usually, sudo commands are followed by a password request, this is a security measure to prevent malware from getting automatically installed on our computers.
In our factory analogy, the manager needs the company credit card to make the purchases necessary to install the conveyor, so by using the the term “sudo” in our command and typing in the password, we are giving the manager the permission to use the company credit card!
To understand what command and sub-commands mean, you can think of the main command as an app and the subcommand as a button inside that app. So in essence, you are asking your computer to open the apt app and push the button named update!
What does apt and apt-get mean?
APT stands for Advanced Packaging Tool which is a tool that is used to manage software in our system and apt is the software used to communicate this APT software management tool.
The words “manage software” in the above paragraph simply refer to these 5 basic tasks
- install software
- remove software
- upgrade software
- upgrade system
- maintain the list of software that is installed in our system
The commands apt and apt-get are both front-end interfaces to invoke the functionalities of APT. You can think of them as 2 different remotes to control the same TV, one has more options are are suited for techy users while the other is meant for beginners.
If you are interested to learn more about how software packages are managed in Linux I highly recommend reading the article in the link below.
A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm
Let us see how software in Linux is organized by answering the following questions.
What are packages in a Linux System?
Linux OS is basically made up of 3 parts
- The hardware
- The Linux Kernel and
- Software packages that work with the Kernel to give us a complete Operating System
In simple words, hardware, as we know, includes CPU, HDD, SSD, RAM, and all the other components that make up your computer. The kernel is a special software that takes all the available hardware resources and virtualizes and manages them. The software packages are typically applications that we run which can make use of these hardware resources by requesting access to them through the kernel.
Examples of software packages can include application software like text editors, word processors, etc. or they can be the GNU utilities like bash, cron, dd, etc., or they can be device drivers to talk to the hardware.
These packages are managed by a special class of software known as “Package managers” which are explained in the article linked here.
Next, let’s have a brief look at what is included in these “Packages” of software.
Contents of packages
The content of the packages managed by these package managers involves the following 4 main components
- Binaries or the executable programs
- metadata files containing the version, dependencies, signatures, and other relevant information
- documentation and manuals
- configuration files
These packages are stored online in servers. These places are called software repositories.
What are Software Repositories?
This is the next question we must address. Repositories (or repos for short) are basically a place where verified packages are stored for easy retrieval and installation. They can be online like the APT repository or they can be on a local folder or a DVD where you have a special collection of software that you need.
This is one of the strong areas of Linux against other operating systems like Windows and Mac OSX, because on the 2 latter OSes we usually need to go to the software vendor’s website to download a software package and manually install them, whereas in Linux you can just type one line of code to get your desired software!
Also because we need to go-to some untrusted vendor website to download software, which are not curated by the OS, there can be security issues where a malware could be come along with the download, whereas in Linux as long as you stick to the official software repositories, you don’t need to worry about security issues as these software are already verified before being stored in the repo!
Windows and Mac OSX are improving this situation through their app-stores but Linux is miles ahead of other OSes in this race!
You can have several repositories from which you can download and install these packages. These can be
- official repos of your particular distro (some have guaranteed support while others are not entirely supported) and
- 3rd party repos
What is a Package Source List?
This is a list of packages available for installing on a given distro. This list is maintained by your Linux machine. The information in this list usually includes the locations of various repositories from which software can be installed. These locations are usually on the internet.
This list is often stored in the /etc/apt directory. You can view and edit this list the same way you can view any other text files using one of your favorite text editors like vs-code, gedit, nano or vim.
If you are using Ubuntu or one of its derivatives, you can also view this list by typing in the following command in the Linux terminal
cat /etc/apt/sources.list
The screenshot below shows the output of the above command.
As you can see from the above screenshot, this list basically contains some URLs to locations on the internet. From these locations, further information can be collected like
- the latest bug fix updates
- the latest version of each available package in the main repo
- the latest version of each available package in the partner repos
If a particular URL has “#” in front of it, it will be ignored as comments.
Let’s go ahead and visit one of these repos to see what it actually contains. You can try going to this link. The screenshot below shows its contents.
Downloading and extracting the Sources.gz file gives a file named “Source” with no file extension. You can open it using any text editor and it reveals a massive file with more than 28,000 lines!
The screenshot above shows one of the packages named zsh, and the information it contains.
zsh is an alternative of bash shells, if you do not know what these packages are for, just focus on the main point here which is as you can see it contains information like
- the latest version of the software
- the dependencies of this particular software etc.
The Short Version of the Answer Revisited!
Now that we have seen all the necessary building blocks to answer the question in this article’s title, let us go ahead and revisit what we saw in the section “The Short Version of the Answer”
Let us just focus on the apt update command this time around, as we have already established the fact that both these commands do almost exactly the same thing!
The screenshot below shows what the output of the command looks like.
Your output might look a bit different than mine, but the important things to note here are the “Hits”. All of these web addresses are repos that contain software. As you can see the last line says “Reading package lists… Done” which means that my computer went ahead and read all the available software in the repos and compared them with the version present on my end and found that they are up-to-date!
So in essence, what we are doing when we enter either the “apt update” command or the “apt-get update” command is that we are asking our Linux machine to go browse these lists and copy the latest version of them, and put them in our computers!
This is the reason we need to run either of these commands regularly before we install any software so that the lists we use to get our software packages are always up-to-date!
Where to get more information about these commands?
So the next logical question to ask is, is there a better way to quickly remind yourself of what this 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 from 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-line on your terminal.
man apt
and you will get something similar to the screenshot below
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
Now that you know how to move around man pages, 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
By “configured sources” the manual means the sources listed in the /etc/sources.list file.
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!
apt vs apt-get commands
Next, let’s have a look at the comparison of apt and apt-get commands
apt | apt-get | Action |
apt install <software name> | apt-get install <software name> | Installs a software |
apt remove <software name> | apt-get remove <software name> | Removes software but keeps configuration (user settings) files |
apt purge <software name> | apt-get purge <software name> | Removes and deletes configuration files |
apt update | apt-get update | updates packages list |
apt upgrade | apt-get upgrade | upgrades software to their latest versions |
apt full-upgrade | apt-get dist-upgrade | upgrades packages and removes old unnecessary ones |
apt autoremove | apt-get autoremove | removes unnecessary dependencies |
apt search <keyword> | apt-cache search | searches packages based on keyword |
apt show | apt-cache showpkg | shows information about a package like version, dependencies, etc,. |
apt list | – | lists packages based on certain criteria |
apt edit-sources | – | edits sources.list file with some sanity checks |
Other than the ones listed above, the “apt-get” family of commands has more commands that have no substitute yet in the “apt” family. Some examples include
apt-get build-dep
apt-get check
apt-get download
apt-get changelog
apt-get clean
apt-get autoclean
apt-get changelog
apt-get indextargets
Just type
man apt-get
man apt-cache
to get a list of options supported by apt-get and apt-cache
I leave it unto you to read the man pages and try out these commands for yourself and play with them!
When to use apt and when to use apt-get?
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 need to go into the script files and edit them again version after version till its finalized. 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.
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!
Here are some of our other articles that might be interesting to you!