After installing the Raspbian operating system on a Raspberry PI board SD card, the firmware and Raspbian software should be upgraded to the latest versions.
Upgrades also need to be done from time to time to make sure that your PI software contains the latest bug fixes and improvements.
Upgrading the Firmware
The firmware upgrade updates the Broadcom firmware / bootloader software for the Raspberry PIs Broadcom processor chip (technically SoC — System on a Chip).
To upgrade the firmware, enter this command on the command line:
sudo rpi-update
You will then need to reboot the PI for the changes to be loaded:
sudo shutdown -r now
The firmware resides on the SD card with the operating system.
Upgrading the Software Packages
To upgrade the actual Raspbian operating system, first the list of updates must be obtained by running this command from the command line:
sudo apt-get update
Now the actual updates must be installed by running:
sudo apt-get upgrade
Further, if updates require new packages to be added or existing packages to be removed, the following command will do this:
sudo apt-get dist-upgrade
The dist-upgrade command will not update the software to the latest distribution but allows addition and removal of packages, whereas upgrade only upgrades packages to the newest version. Most of the time using just the apt-get upgrade command will be fine, however, see the resources below for a better understanding on when each one is needed.
The apt-get commands above apply to any Debian Linux based operating system, not just Raspbian. These commands can be used on Debian, Ubuntu desktop, Linux Mint, Ubuntu Server, etc.
Resources
The following resources describe the differences between apt-get upgrade and apt-get dist-upgrade better, as well as provide a reference for other apt-get commands.