/ linux

Ubuntu: apt-get update & apt-get upgrade

Important to know that 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.

  • 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.

  • 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.

  • 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:
sudo apt-get update && sudo apt-get install foo bar
or to get newest versions possible as per version requirements of dependencies:
sudo apt-get update && sudo apt-get dist-upgrade
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).

Ubuntu: apt-get update & apt-get upgrade
Share this

Subscribe to NL Slack