If you want to keep your Ubuntu or Debian system updated, you use the combination of sudo apt update and sudo apt upgrade commands.
Some older tutorial also mention sudo apt-get update and sudo apt-get upgrade.
Both apt and apt-get commands work pretty much the same except for some minor differences that I’ll discuss later in this later.
Let’s first discuss the difference between update and upgrade. Are not the two the same thing?
Difference between apt update and upgrade
Though it sounds like running the apt update will give you the latest version of the package, it’s not true. The update command only gets the information about the latest version of packages available for your system. It doesn’t download or install any package. It is the apt upgrade command that actually downloads and upgrades the package to the new version.
Still confused? Let me explain a bit more. I advise reading up on the concept of package manager. It will help you understand things even better.
Basically your system works on a database (cache) of available packages. Note that this cache or database doesn’t contain the packages themselves, just the metadata (version, repository, dependency etc) on the package.
If you don’t update this database, the system won’t know if there are newer packages available or not.
When you run the apt update or apt-get update command, it will fetch the updated metadata (package version etc) on the packages.