Difference between apt upgrade, apt full-upgrade, and do-release-upgrade.

Difference between apt upgrade, apt full-upgrade, and do-release-upgrade.



There's an apt upgrade, apt full-upgrade, and do-release-upgrade command.
Whaaaaaaaaat _
Well..., don't confuse the three commands to upgrade a Debian- or Ubuntu-based machine as they do different things.
Confusing _
That's why we are here for _ seat and relax, let us jump right in.


apt upgrade

Before updating any packages, the package index must always be updated. This updates the package lists in the /etc/apt/sources.list file and /etc/apt/sources.list.d directory. According to the man pages, the command apt upgrade ( for newer releases such as Ubuntu 18.04 and later & Debian 10) or apt-get upgrade ( for older Debian/Ubuntu releases) is used to upgrade currently installed software packages to their latest versions. Existing packages are never deleted under any circumstances. If a package upgrade requires the removal or the installation of additional packages, the upgrade of the installed package is skipped and the package remains untouched in its current version.

$ sudo apt update

Then

$ sudo apt upgrade 

Remember, apt upgrade does not remove packages, it only upgrades.


apt full-upgrade

This is an enhanced version of the apt-upgrade command. Apart from updating current software packages, it installs and uninstalls some items to meet requirements. The command features a clever conflict resolution function that guarantees key packages are upgraded first, at the expense of those regarded as less important.


Can you use apt full-upgrade as a regular upgrade tool?

Running this command requires special care to be used safely, and there's no real good reason even for very experienced users to run them routinely. It will delete software–if it is required to complete the process. To be 100% safe make sure to carry out upgrades on a test environment before running on production.


do-release-upgrade

The do-release-upgrade command, on the other hand, upgrade Ubuntu to the latest available version. So if you want to upgrade from Ubuntu 20.04 LTS (focal fossa) to 21.04 (Hirsute Hippo), you use do-release-upgrade. However, in order to use this command, the system must first be fully upgraded. To do that, you should first run, sudo apt upgradefollowed by sudo apt full-upgrade. When those two are complete, you can then run sudo do-release-upgrade.


The difference between these commands is crucial. In fact, you might want to read up on their respective man pages to learn more. To do that, issue the commands man apt, man apt full-upgrade, and man do-release-upgrade.