apt-get update

In a nutshell, apt-get update doesn’t actually install new versions of software. Instead, it updates the package lists for upgrades for packages that need upgrading, as well as new packages that have just come to the repositories.

  1. apt-get update downloads the package lists from the repositories and “updates” them to get information on the newest versions of packages and their dependencies. It will do this for all repositories and PPAs.
  2. apt-get upgrade will fetch new versions of packages existing on the machine if APT knows about these new versions by way of apt-get update.
  3. apt-get dist-upgrade will do the same job which is done by apt-get upgrade, plus it will also intelligently handle the dependencies, so it might remove obsolete packages or add new ones

You can combine commands with && as follows:

or to get newest versions possible as per version requirements of dependencies:

You need sudo both times, but since sudo by default doesn’t prompt you within 5 or so minutes since the last sudo operation, you will be prompted for your password only once (or not at all).