🍃Update, Upgrade, and Clean Linux

Colourful bash script to update, upgrade and clean your machine.

The script:

#!/bin/bash/ 

echo 

echo -e "\e[1;32m Step 1: Updating packages \e[0m"
sudo apt-get update

echo

echo -e "\e[1;32m Step 2: Upgrading packages \e[0m" 
sudo apt-get upgrade -y
sudo apt-get dist upgrade -y 
sudo apt-get update

echo 

echo -e "\e[1;32m Step 3: Cleaning up \e[0m"
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove

exit 

Could be better…

So the output of this script is good, but technically speaking, we are missing a few major pieces here.

Firstly – What happens if the script fails? We could have a red text that comes up telling us how or why the script failed to run.

Secondly – We are not logging anything here. We can add this to system logs or our own personal log files. This would become more important if you were tracking when the Linux system was last updated for audit purposes.

Why don’t you try and make this script better?

Build on it, edit it, and use it. Then share this with me, I would be really interested in seeing what changes you can come up with for this.

Last updated