How to update Raspberry Pi OS
This page is part of a collection of notes that I am making on useful commands for Raspberry Pi OS, formerly know as Raspbian.
To update the OS, use the apt tool and follow this sequence:
Update the system’s package list:
$ sudo apt-get update
You can also use:
$ sudo apt update
Although both commands are basically equivalent and apt is newer and more user friendly, the apt-get command is more stable for scripts.
Next, upgrade all installed packages to the latest versions:
$ sudo apt-get dist-upgrade
You can also use:
$ sudo apt full-upgrade
Both commands are equivalent and remove/install/upgrade packages. The result should be the same in both cases.
Next step, do some clean-up:
Erase downloaded archive files:
$ sudo apt-get clean
Remove all unused packages:
$ sudo apt-get autoremove
These commands are only available with apt-get.