If you are completely new to any terminal commands please click here to read more into getting started with the terminal.
There could be many reasons for wanting to create a bash script I use them for multiple reasons. The main bash script that I always update is one I have created for a fresh install of Ubuntu and can easily be modified for any Debian based system. You can find mine at the bottom of this post. To get started you need nothing more than a text editor. I use Gedit for pretty much anything like it you can install that by searching for it in the software center or by typing:
sudo apt install gedit
So what I am going to recreate today and explain it is my main bash file for a fresh install. First, load Gedit and let’s get typing:
On line one, you will want to update and upgrade the reason being: It brings your system up to date. so just type:
sudo apt update && sudo apt upgrade -y
That script as it stands will not Update the repositories and Upgrade the system without asking for a Yes or a No thanks to -y command at the end. We are going to use -y a lot in this script.
Now I don’t use firefox at all as I prefer Google Chrome and I really do not see a need to keep firefox so in the next line down I’m going to enter this:
echo removing firefox
This echo command will input “Removing Firefox” inside the terminal Window, this is completely optional I just like to do this so I can keep track of where the script is up to. Then I will type on the next line down:
sudo apt purge Firefox
So That’s Firefox now a thing of past on the system. Now we want to start installing stuff. On the line down enter:
sudo apt install gimp
sudo apt install inkscape
sudo apt install kdenlive
sudo apt install audaciousand so on with the software you want to install. In this example we have installed Gimp, Inkscape, Kdenlive, Audacious just replace these with software you want instead.
Now to get Chrome and Install it:
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo rm google-chrome-stable_current_amd64.deb
Now, let’s run a clean up:
sudo apt auto-remove -y
Let’s end the script with Exit so just type
That’s is a very simple script for your next fresh install. Now you want to save that document as whatever.bash. Now navigate to you where you saved it and right click it and in permissions allow execution. Now to load it. Load a terminal window and type sh then the locations of where and what you saved it as for example mine is on the desktop so I would type:
As it is on my Desktop.
as I stated earlier I will post the one I use for myself so you can compare it to yours and maybe start adding system popups as I did, also this script uses SnapD this will make it so it’s not just a Ubuntu Script, to get that just type.
sudo apt install snapd
Here it is:
# My Script for a fresh install. #update and upgrade (essential) sudo apt update sudo apt upgrade -y # removing stuff sudo purge thunderbird -y sudo apt purge firefox -y # Standard Repos echo Installing software from repos sudo apt install default-jre sudo apt install gimp -y #removed due to snap being better #sudo apt install kdenlive -y sudo apt install openshot sudo apt install ssh -y sudo apt install ffmpeg -y sudo apt install vlc -y sudo apt install inkscape -y sudo apt install filezilla -y sudo apt install evolution -y sudo apt install audacious -y sudo apt install net-tools -y sudo apt install htop -y sudo apt install iftop -y # Removed in case you run it and you're not on a Gnome based desktop #sudo apt install gnome-tweaks -y sudo apt install trash-cli -y # Clean up starts here sudo apt update sudo apt auto-remove -y # Snap Items echo Installing Snap Items sudo snap install spotify sudo snap install atom --classic sudo snap install netbeans --classic # newer than repositories and better also sudo snap install kdenlive echo Downloading and installing non repo items # chrome on its own cd Downloads wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome-stable_current_amd64.deb sudo rm google-chrome-stable_current_amd64.deb # Last clean up trash-empty # Complete echo All Set Up notify-send "All Done" "Everything is installed and cleaned up" exit
As a small disclaimer, this is an example of what I use. If you decide to make this bash script by copying and pasting it. It will delete Thunderbird and Firefox and will install everything on the list and you may not want or use the programs. So please ensure you add/remove and change to the software you require before running.