Ubuntu the difference between sudo apt-get upgrade and sudo apt-get install?

My google search is little helpful so I asked here.

What is the difference between sudo apt-get upgrade and sudo apt-get install?


Short answer citing the comment by @Evgeniy Yanuk

For install you have to point a package or packages you want to install or upgrade. upgrade checks all your installed packages and updates them if it's needed.

Update

  • Update the list of all current program packages in the repositories in order to determine which packages are candidates for upgrading.

    sudo apt-get update   # old syntax
    sudo apt update       # new syntax
    

Upgrade

  • Upgrade all current program packages in the Ubuntu operating system, that are installed automatically or from the repositories or from a PPA.

    sudo apt-get upgrade  # old syntax
    sudo apt upgrade      # new syntax
    

    or if you want to upgrade and also perform checks and fixes to upgrade to a fully upgraded and compatible system (this is what I do),

    sudo apt-get dist-upgrade  # old syntax
    sudo apt full-upgrade      # new syntax
    
  • Install a program package, a new package that was not yet installed

    sudo apt-get upgrade  # old syntax
    sudo apt upgrade      # new syntax
    

Update & Upgrade

  • When you intend to upgrade the system (within the same version of Ubuntu), you can run one of the following command lines

    sudo apt update && sudo apt upgrade
    sudo apt update && sudo apt full-upgrade
    

Install

  • When you intend to install a new program package, you can run the following command lines. It is a good idea to update before installing.

    sudo apt-get update                        # old syntax
    sudo apt-get install program-package-name  # old syntax
    
    sudo apt update                            # new syntax
    sudo apt install program-package-name      # new syntax
    

Edit:

If you call apt install without any parameter (no package specified), it will tell you if there are packages to upgrade, but it will not upgrade anything.

end of edit


Manual page

You find more details in the built-in manual

man apt-get  # old syntax
man apt      # new syntax

Upgrade to a new version alias release of Ubuntu

This is a completely different task. It is complicated and risky. Backup everything that you don't want to lose before you start on this venture.

sudo do-release-upgrade

You find more details in the built-in manual

man do-release-upgrade

This method works from a previous version to the next version. There is one exception: You can also do-release-upgrade from the previous LTS version to the next LTS version, for example

  • from Ubuntu 14.04 LTS to 16.04 LTS
  • from Ubuntu 16.04 LTS to 18.04 LTS

Before starting you should

  • remove all PPAs and non-standard program packages (that do not belong to the Ubuntu repositories), because they can break the release-upgrade process,

  • update & full-upgrade the current system, so that it is up to date.

Install a fresh system

It is often easier and faster to install a fresh system than to do-release-upgrade, particularly if there are several steps, or if the new version is very different from the previous one.

Remember to backup everything that you don't want to lose before you start on this venture.