Raspberry-Pi : Update
Before you start... FYI... Check available space!!
When running sudo apt-get upgrade, it will show how much data will be downloaded and how much space it will take up on the SD card. It's worth checking with df -h that you have enough disk space free, as unfortunately apt will not do this for you. Also be aware that downloaded package files (.deb files) are kept in /var/cache/apt/archives. You can remove these in order to free up space with sudo apt-get clean.
To upgrade installed packages
$ sudo apt-get update
$ sudo apt-get upgrade
Reboot after the updates
$ sudo sync
$ sudo reboot
To upgrade to the latest Debian distribution
$ sudo apt-get dist-upgrade
Only to be performed when system requests it
Update firmware
$ sudo rpi-update