DEV Community

Cover image for Updating Ubuntu has never been easier
Benedikt Schächner for Technology Schächner

Posted on • Originally published at github.com

Updating Ubuntu has never been easier

Updating Ubuntu has never been easier - thanks to us!
We have the optimal solution to install any available update with just one click!


If you like this or any other article, we would appreciate a like and a comment. ❤️


Don't you believe us? Then let yourself be carried away into the world of Ubuntu update codes!

GitHub logo Technology-Schaechner / Ubuntu-Update-Script

a simple, quick-to-install update script for its own servers running Ubuntu.

Update-Skript

a simple, quick-to-install update script for its own servers running Ubuntu.

Install dependencies

sudo apt install figlet toilet

Run

sh update.sh




A simple update in Linux always consists of several parts. So we thought it wouldn't make more sense if we just code something so that we only have to enter one line of code, but all updates are executed.
Said and done.

sudo echo "
echo -n UPDATE: && sleep 3 && sudo apt update -y && sudo apt-get update -y &&
echo -n UPGRADE: && sleep 3 && sudo apt upgrade -y && sudo apt-get upgrade -y && 
echo -n FULL-UPGRADE: && sleep 3 && sudo apt full-upgrade -y && sudo apt-get full-upgrade -y &&
echo ---- &&
echo -n Your system has been updated, echo "$USER" &&
sleep 1 &&
figlet You are up to date, &&
toilet "$USER" &&
sleep 5 &&
clear
Enter fullscreen mode Exit fullscreen mode

Now all updates are done at once - even with a personalized message at the end. But to get this personalized message, we need figlet
and toilet. We'll install that with sudo apt install figlet toilet.
The code in general is a shell script.
Let's break down the code step by step:

sudo echo"
Enter fullscreen mode Exit fullscreen mode

This line is using sudo to elevate privileges and execute the echo command. However, the use of sudo with echo won't have any impact on the output. It essentially outputs an empty line with a newline character.

echo -n UPDATE: && sleep 3 && sudo apt update -y && sudo apt-get update -y &&
Enter fullscreen mode Exit fullscreen mode

This line outputs the text "UPDATE:" without a newline (-n flag), then it waits for 3 seconds using sleep, followed by running the system package update commands. Both sudo apt update -y and sudo apt-get update -y are used to update package information from the repositories.

echo -n UPGRADE: && sleep 3 && sudo apt upgrade -y && sudo apt-get upgrade -y &&
Enter fullscreen mode Exit fullscreen mode

Similar to the previous line, this line outputs "UPGRADE:" without a newline, waits for 3 seconds, and then proceeds to perform system package upgrades using sudo apt upgrade -y and sudo apt-get upgrade -y.

echo -n FULL-UPGRADE: && sleep 3 && sudo apt full-upgrade -y && sudo apt-get full-upgrade -y &&
Enter fullscreen mode Exit fullscreen mode

This line is again similar to the previous lines, but it's executing a full system upgrade using sudo apt full-upgrade -y and sudo apt-get full-upgrade -y.

echo ---- &&
Enter fullscreen mode Exit fullscreen mode

This line prints a line of dashes to serve as a separator between the update/upgrade information and the following message.

echo -n Your system has been updated, echo "$USER" &&
Enter fullscreen mode Exit fullscreen mode

This line attempts to print the message "Your system has been updated" without a newline. The subsequent echo "$USER" should be a separate command to correctly print the username of the currently logged-in user.

sleep 1 &&
Enter fullscreen mode Exit fullscreen mode

This line introduces a 1-second delay using sleep.

figlet You are up to date, &&
Enter fullscreen mode Exit fullscreen mode

This line uses the figletcommand to create an ASCII art text that says "You are up to date". The output will be stylized text.

toilet "$USER" &&
Enter fullscreen mode Exit fullscreen mode

This line uses the toilet command to create another ASCII art text, this time displaying the username of the currently logged-in user.

sleep 5 &&
Enter fullscreen mode Exit fullscreen mode

Another delay of 5 seconds is introduced using sleep.

clear
Enter fullscreen mode Exit fullscreen mode

This command clears the terminal screen.


Thank you for reading this far. Do you have any questions, suggestions or requests? Feel free to write it in the comments!

Top comments (0)