[HOW TO] UPDATE AND UPGRADE SCRIPT - update & upgrade your whole system using this bash script I wrote

I wrote an update script to update and upgrade the whole system including flatpaks with the option to reboot the system at the end. Dependencies is neofetch and flatpaks perfect for Pro editions but can be used for non Pro.

Just comment out # what you don't need in the script. To use copy over to your home folder and run sudo bash update.sh in ther terminal but make sure file is marked as executable. I have attatched images below.

I hope this helps others as much as it helps me :grinning:

1 Like

If anyone has any problems feel free to let me know :grinning:
If urgent twitter is your best bet at https://twitter.com/justincroser

I think it would be nice if you could share the script over GitHub or similar. That way we can examine the script without having to download anything.

You can view the script in a default text editor on the OS once downloaded if you don't want to run it. I may create a GitHub account if I make more scripts as I only have the one so far

1 Like

There are a lot of members that have a difficult time following links to personal drives. Anything could be on the other side (no offense intended). It may be beneficial for all if you would paste the script into the code option of markdown, available in every post to the site. This is the recommended way to share code/scripts if github is not viable.

To ensure we consider others and their right to both privacy as well as their opinion, you may want to edit your original post with the script, as was done in the lounge for the python scripts.


Agreed, it's a habit for me to not download random stuff from the internet without at least having the chance to examine it before hand. I really think more people should familiarize themselves with that, as it's one of the most common forms to download malware in your computer. Not to mention the privacy aspect.

In this case though, I was asking mostly for the source code out of convenience. It's just a lot easier to read and find the code when it's posted online.

I just have this function in my .zshrc that does the exact same thing:

function update(){
sudo apt update
sudo apt upgrade
flatpak update

You can copy paste the above code in your .bashrc file.

Then, it's a simple command: update in your terminal to update flatpaks and apt packages.

Seeing as everyone has a problem this is the full script


#Assumes you have Neofetch / Flatpaks / Piholes installed. Comment out whats not needed

#Don't forget to CHMOD + x this file to make it executable but I should've already done that for you'.

#Made by Justin Croser https://justincroser.net I am not responsible for any breakages use at your own risk however I doubt it will be a problem with the script except an distribution update / dependancy issue' 

#Debian based servers
apt update
apt upgrade -y
#I like a clean system, but these may or may not be helpful.
apt autoclean -y
apt autoremove -y

#Fedora/Redhat machines
#dnf update -y

#Updates Flatpaks
flatpak update -y

#Updates Pihole if you have one
#pihole -up

#Ask if user wants to reboot the systm? Useful for home servers
read -r -p "Reboot? [Y/n] " input
case $input in
		echo "You have opted to reboot!"
			systemctl reboot -i
		echo "You will not reboot right now!"
			exit 1
		echo "Invalid input..."
		exit 1

I will not help in the future. - Justin

It is understandable that different views on how to approach file sharing can be frustrating at times.
That is a great script, @justinc - thanks for sharing.

Exploring the control at your disposal with scripting is great development and practice.
Please keep in mind that it is a helpful suggestion to provide a means of reviewing scripts prior to downloading.


Justin - I think that is a bit of an overreaction to what I read as constructive comment. I hope you will reconsider as your contribitions are appreciated.


I second this sentiment. :slight_smile:
We all feel unappreciated from time to time.


I third that.

When I make my icon themes I always include link to github so people can examine my work, so don't take offense off it. See it as a people are interested in it :slight_smile:


I am only starting out in scripting so I didn't see the need for a github page. I do however see the issue I just got the vibe that I was trying to install or have users do things to their system which they don't want to do. (hence my issue with snaps so I don't use them)

There is no malice intended or in the script, a small disclaimer is because I'm not responsible for developers packages or the OS itself. Even on arch we are somewhat responsible on what we install and how we use but if a package breaks the system we must diagnose or fix it ourselves until a update fixing said bug comes in.


Added on to this I now have the code over on my GitHub page for all to see justincroser (Justin) ยท GitHub

1 Like

Very clean looking.

1 Like

All of the commands are commented out. The only thing that will run is the reboot part of the script. At least the apt update and upgrade should be Uncommented with instructions on how to make use of the other commands.

No need to chmod, you can run by sudo bash update.sh. Since you didn't include sudo in the script it must be included in the running of the script.

Anyone that isn't a power user or more knowledgeable won't understand why the script doesn't work.

1 Like

Thanks for the advice. I have created a new version of the script itself for most linux based systems, ubuntu, debian, arch, fedora, redhat etc... I will make 3 new paths for the actual type of operating systems so it's ready to go for noobs and power users alike.