Apt Update vs Upgrade – What’s the Difference?

Last updated: July 8, 2022

The apt update and upgrade are two of the most commonly used yet misunderstood commands for many Linux users. For some, these play the same role, which is not the case. In this guide, we seek to distinguish the differences between sudo apt update and sudo apt upgrade.

Difference between apt update and upgrade

The main difference is that apt update gets the package list from your software repositories including the third-party repositories which you manually configured. Whereas the apt update process actually upgrades and installs new and existing packages.

1. apt update

This is a command that is mostly invoked after a fresh system install or before installing a new software package. The apt update command updates the package index of a Linux system or package lists. It does not upgrade any packages, as some Linux users are misled to believe.

The package index file is a file or database that contains a list of software packages defined in repositories located in the /etc/apt/sources.list file. Other lists of packages are located in the /etc/apt/sources.list.d directory.

It's extremely safe to run this command. You can resume from where is stopped if for some reason aborted or unplugged.

Use the cat command on the terminal to view the sources list file.

cat /etc/apt/sources.list
/etc/apt/sources.list file
/etc/apt/sources.list file

To update the package lists, invoke the command:

For Ubuntu 18.04 and later releases

sudo apt update
sudo apt update
update package lists

For Ubuntu 16.04 and earlier releases

sudo apt-get update

2. apt upgrade

Need to upgrade your software packages to their latest versions? Then apt upgrade is the command to execute. The apt upgrade command, without any arguments, upgrades all outdates packages residing on your system to their latest versions.

If any dependencies are required, the command also triggers the installation of new packages. Along with that, apt upgrade also installs all the security updates needed by your system, and this fortifies the security of your system.

To list packages that are due for upgrade, run the apt list --upgradable command. In fact, this is a hint that is displayed at the very end of the apt update output.

So, to have a view of packages ready to be upgraded, run:

sudo apt list --upgradable
 apt list --upgradable
apt list --upgradable

To upgrade all the outdated packages and apply security patches, run the command:

sudo apt upgrade
sudo apt upgrade
apt upgrade

It is more safe not to disrupt or about the apt upgrade while it is running.

Few things to keep in mind:

Do you have a good backup to revert back if it breaks for some reason?

Are you sending logs to another remote system?

Any manually compiled software?

Summary

The apt update command is used in synchronizing the package lists on your system. It fetches the latest package lists for PPAs and repositories on your system and ensures that they are up to date.

The apt upgrade command upgrades packages to their latest versions and installs new packages if they are required as dependencies. It does not remove any packages and if any are earmarked to be removed, it skips them.

About The Author

Winnie Ondara

Winnie Ondara

Winnie is a Linux technical writer with over 3 years of experience with various Linux distributions and writing technical guides in Linux. She is passionate about FOSS technologies and always endeavor to learn new technologies. During my free time, I watch movies, listen to music, and catch up with tech news.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment