Sudo apt update vs upgrade: What’s the Difference? – It’s FOSS

If you want to keep your Ubuntu or Debian system up to date, use the combination of the sudo apt update and sudo apt upgrade commands.

Some previous tutorials also mention sudo apt-get update and sudo apt-get upgrade.

Both the apt

and apt-get commands work more or less the same, except for a few minor differences that I’ll discuss later in this.

Let’s first look at the difference between upgrade and upgrade. Aren’t the two the same thing?

Difference between

apt update and update Although it

seems that running the apt update will give you the latest version of the package, it is not true. The update command only obtains information about the latest version of the packages available to the system. It does not download or install any packages. It is the apt upgrade command that actually downloads and updates the package to the new version.

Still confused? Let me explain a little more. I advise reading about the concept of package manager. It will help you understand things even better.

Basically, your system runs on a database (cache) of available packages. Note that this cache or database does not contain the packages themselves, only the metadata (version, repository, dependency, etc.) of the package.

If you do not update this database, the system will not know if newer packages are available or not.

When you run the apt update

or apt-get update command, you get the updated metadata (package version, and so on) in the packages.

The local package cache has been updated and there are packages that can be updated. You can upgrade all packages (upgradeable) with sudo apt upgrade.

It displays the packages to be updated and prompts you to confirm by pressing enter (for the default Y) or the Y key. To cancel the update at this stage, you can press N.

If it helps you remember

: apt update: refreshes the package cache (to

  • know which versions of the package can be installed or updated)apt
  • upgrade: updates packages to the new version

Since these are administrative commands, you must run them as root. And therefore you use sudo with both commands. The sudo part allows you to execute commands as root in Ubuntu and Debian.

Now that you understand how the upgrade and upgrade combination works, let’s discuss the use of apt and apt-get.

apt or apt-get? Which should you use?

Debian and Ubuntu use the APT package management system. Don’t confuse it with the apt command.

There are many commands that interact with APT package management; apt-get, apt, dpkg, aptitude, etc.

The apt-get command was the most popular of all. It is a low-level, feature-rich command. APT is a newer and simpler version of apt-get.

You can read this article to learn about the differences between the apt and apt-get commands. Let me focus on the difference between the update and update options of these commands.

apt update vs

apt-get update

Both apt-get update and apt update perform the same task of updating the local package cache so that the system knows the available package versions

.

Technically, there is no difference. However, apt update does one thing better than apt-get update. Tells you the number of packages that can be updated.

Hit:15 https://ppa.launchpadcontent.net/slimbook/slimbook/ubuntu jammy InRelease Got 213 kB in 4s (55.8 kB/s) Reading package lists… Done Building dependency tree… Done Reading status information… Made 6 packages can be updated. Run ‘apt list-updatable’ to view them.

apt-get update doesn’t even tell you if any packages can be updated.

apt-get update vs apt update

You can see the list of packages upgradeable with apt but apt-get does not have this option.

[email protected]:~$ apt list -upgradeable Listing… Done fprintd/jammy-updates 1.94.2-1ubuntu0.22.04.1 amd64 [updatable from: 1.94.2-1] gnome-control-center-data/jammy-updates,jammy-updates 1:41.7-0ubuntu0.22.04.4 all [updatable from: 1:41.7-0ubuntu0.22.04.1] gnome-control-center-faces/jammy-updates,jammy-updates 1:41.7-0ubuntu0.22.04.4 all [updatable from: 1:41.7-0ubuntu0.22.04.1] gnome-control-center/jammy-updates 1:41.7-0ubuntu0.22.04.4 amd64 [updatable from: 1:41.7-0ubuntu0.22.04.1] libpam-fprintd/ jammy-updates 1.94.2-1ubuntu0.22.04.1 amd64 [updateable from: 1.94.2-1] vivaldi-stable/stable 5.4.2753.40-1 amd64 [updatable from: 5.4.2753.37-1]

Let’s talk about comparing the upgrade option for both commands. apt upgrade vs

apt-get upgrade

The apt-get upgrade and apt upgrade commands install the latest version of the upgradeable packages based on data in the local package cache (updated by the update command).

However, the apt upgrade command does a couple of things differently than its apt-get counterpart.

The apt upgrade

command can upgrade the Linux kernel version, apt-get upgrade cannot do that. You must use apt-get dist-upgrade to upgrade the kernel version with the apt-get command.

This is because upgrading the kernel version means installing a completely new package. The apt-get upgrade command cannot install a new package. You can only upgrade existing packages.

Another little thing that apt upgrade does better than apt-get upgrade is to display a progress bar at the bottom.

The

word update and updates are similar and that is why it confuses many new users. Sometimes, I think the apt update command should be merged with the apt upgrade command.

I mean that the update (of the

installed package versions) works in conjunction with the update (of the local package metadata cache). Why have two separate commands for that? Combine them into a single update command. This is what Fedora has done with the DNF command. That’s just my opinion.

I hope this article has cleared up the use of apt-get update, apt-get upgrade and apt update and apt upgrade commands a bit.

Let me know if you have any questions.

Contact US