Raspberry Pi Bash Script Tutorial to Update + Upgrade

Start: Raspberry Pi Bash Script Tutorial

If you want to update and upgrade your Raspberry Pi but don’t want to run separate commands (i.e. sudo apt-get update, upgrade) you can simply create a bash script to do it for you.

cd /home/pi
nano update.sh

Then you can copy and paste this into your nano editor. After you paste it hit CTRL-x, type y, then enter.

#!/bin/bash -e

# 1. Get Update.
/usr/bin/sudo apt-get update

# 2. Get Upgrade.
/usr/bin/sudo apt-get -y upgrade

# 3. Update rpi
/usr/bin/sudo rpi-update

# 4 Reboot
/usr/bin/sudo shutdown -r

Then run

chmod +x update.sh

Test it by running ./update.sh in the /home/pi directory!

Post any comments or questions below.

For more information you can check out the Raspberry Pi website.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.