Advertisement

Main Ad

Update and upgrade your Kali Linux installation with a script - second version

Howdy, pirates! In my previous (very old) tutorial, I tried to show you how to create a script that will automatically update and upgrade your Kali Linux installation. Since this post is from 2015, you might guess it's actually not working with the current version of Kali.
So, I had to figure out something else. In case you're lazy enough to click on the link above that points to my previous article, I will take the opportunity to quote myself:


Creating scripts is easy in Linux distributions, you just need access to any text editor - Linux has plenty available (gedit or gvim, to name just a few examples) and to some available neurons. In this example we'll use the update and upgrade commands and we'll create ourselves a script that once executed will automatically run the commands for us - this is the easiest example I came-up with.
 
Open your text editor. At the first line write or feel free to copy and paste:

 #!/bin/bash

Press enter and below this line type:


apt-get clean && apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y

Save the text file as "update.sh" - or any other name you would prefer. Once the script is created/made, add it to your "Home" folder - or a folder to your likin':



Now, in order to run the script, all you need to do is type into the console:

sh update.sh

Remember, this depends on the name you gave to your script - and the location (otherwise you might cd into that location).  
*In this example, the script will only work if it's placed in your "home" folder. Otherwise, you will most likely get an error.

Since I've already run my script, the results will be as following:


This is a much better way than running all three commands one by one. At least you can type only one command into your console, instead of three. For sure there are easier ways to do this, I just didn't figure them out (yet).