Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

When to run "sudo apt update" and when "sudo apt update && sudo apt upgrade"?

Writer Emily Wong

As far as I remember, I always run sudo apt update or sudo apt-get update before installing a new package.

When should I run both update and upgrade like this:

sudo apt update && sudo apt upgrade

3 Answers

You run sudo apt update to refresh the list of available packages.

You run sudo apt upgrade to upgrade all installed packages.

Obviously you always run update before upgrade to use the latest list.

2

The ... update part updates the library of available packages, so that your system knows what is available, and can compare them to what is installed.

The ... upgrade fetches the packages from the repositories, and installed or 'upgrades' the packages.

Presumably you would only need the ... upgrade if there were packages to upgrade, however if there are no upgradeable packages, apt exits without error.

I think the man page explains it well:

 update (apt-get(8)) 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. upgrade (apt-get(8)) upgrade is used to install available upgrades of all packages currently installed on the system from the sources configured via sources.list(5). New packages will be installed if required to satisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires the remove of an installed package the upgrade for this package isn't performed.

So depending on your needs, you would want to use update or upgrade or both. Be aware that upgrading packages could bring some difficulties on it's own.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy