Ubuntu – One single command to update everything in Ubuntu

command lineupdatesupgrade

I know that there are three command to update and then upgrade the whole system, these are:

  • sudo apt-get update # Fetches the list of available updates
  • sudo apt-get upgrade # Strictly upgrades the current packages
  • sudo apt-get dist-upgrade # Installs updates (new ones)

Is there a super-upgrade command that combines all these commands to one?

Best Answer

There are 3 decent choices:

  1. You could create a script something like the following:

    #!/bin/bash
    set -e
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    

    Call it something like update.sh and place it in /usr/local/bin and then make the script executable by running:

    sudo chmod +x /usr/local/bin/update.sh
    
  2. Another method would be to create a bash alias (in ~/.bashrc) or wherever you normally store your aliases:

    alias update='sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade'
    
  3. A final method would be to simply string the 3 commands together on the commandline:

    sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
    

A few choices...

Reference:

Related Question