I’m always forgetting how to update my raspberry pi, this is just short & to the point cheat sheet. If you’re accessing the pi remotely, the following commands can be run within a regular powershell terminal via Windows. Just make sure that you have the OpenSSH Client enabled on your windows machine. You should find this under Apps & Features > Optional features
.
Updating the OS
Raspberry uses a package management system to handle it’s updates (similar to npm, composer, yarn etc etc), so we need to check what we need to be updating first. Note that the keyword apt
is used by Debian based systems (such as Raspbian & Ubuntu), so this may be different depending on the OS:
sudo apt update
Sudo
is always used for elevated/important commands like this. Think of it as running a program in Windows as an administrator (like cmd terminal). You’ll be using it a lot in a Linux environment. So get aquainted. According to wikipedia, sudo is also sandwich related. But I’m not sure why.
When we’ve updated our list, we’ll see just what needs updating. The terminal should let you know what to do next.
A full upgrade will be performed with the following command. It will ask for confirmation, where you will need to press y
to continue:
sudo apt full-upgrade
This upgrade may take a long time, depending on when you you last performed the upgrade. Once it’s done, you’ll want to reboot your pi:
sudo reboot
Post install cleanup
There will likely be some leftover files when your updated has completed, so you’ll want to clean them up. You’ll need to run these commands, one after the other:
sudo apt autoremove
sudo apt clean
Alternatively, you can run this all as one single command consecutively as follows:
sudo apt autoremove && sudo apt clean
With that, you should be done! This is how you update a raspberry pi!
My thoughts on Linux
I haven’t really had chance to get into linux, but it seems to handle things like updates in a very streamlined day. The only downside is that you will likely need to use the terminal. I hope to cover cmd basics in a later article. It’s a very powerful tool once you get the hang of it.