I understand that sudo apt-get update only updates the package list whereas sudo apt-get upgrade will install the newer version of the package.

But will sudo apt-get update && sudo apt-get install be equivalent to sudo apt-get install followed by sudo apt-get upgrade?

1 Answer 1


I’m not 100% sure what your question is exactly, but perhaps a general answer will help.

The various apt operations behave as follows:

  • update retrieves the current package indexes from the repositories
  • install installs the listed packages and any necessary dependencies, using the package indexes available locally (so it might fail, if the indexes refer to package versions which are no longer available in the repositories or the package cache)
  • upgrade upgrades all installed packages to the latest versions listed in the package indexes available locally, following the pin priorities (this might fail for the same reason as install); it also installs any newly-required dependencies

If you install a package with out-dated indexes, then update and upgrade, you’ll end up with the same installed version as you’d get by updating before you install, as long as the older version is still available in the repositories. Strictly speaking the installation isn’t exactly equivalent: installing a new version from scratch isn’t quite the same as installing an older version and upgrading. Assuming no bugs, the result should be the same (apart from obsolete configuration files, but that’s a minor concern).

It’s always best to update before installing or upgrading, unless you’ve updated since the last mirror pulse (I’d have to check how often they happen now; if you updated within the last day you should be fine).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .