There’s a few key commands needed to update & upgrade software, firmware and the OS running on the Raspberry Pi.
sudo apt-get update
First use apt-get update to update package lists and information about newest versions of software and their dependencies.
# Using apt-get update before installing new software ensures that the newest version is installed.
sudo apt-get upgrade
Use apt-get upgrade to upgrade all software packages and firmware to the newest version.
sudo apt-get upgrade -y
The apt-get upgrade command will prompt to confirm [y,n] that you want to proceed. You can pre-confirm by adding -y at the end of apt-get upgrade.
sudo apt-get update && sudo apt-get upgrade -y
Both apt-get update and upgrade commands can be strung together with two ampersands, executing both one after the other.
You can also update the OS distribution with the following command.
sudo apt-get dist-upgrade
So if you want to update and upgrade everything all in one go and you don’t want to confirm at every step of the way then use the following command.
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y
Now everything will be up to date. It’s also a good idea to do this periodically to keep your Raspberry Pi up to date.