Last active
February 8, 2026 06:31
-
-
Save Satal/f2a9ded88005fe8f573ea2725db0970b to your computer and use it in GitHub Desktop.
An update script for ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| # Check for root | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "This script must be run as root" 1>&2 | |
| exit 1 | |
| fi | |
| echo "=== Updating package lists ===" | |
| apt update -y | |
| echo "=== Upgrading packages ===" | |
| apt upgrade -y | |
| echo "=== Distribution upgrade ===" | |
| apt dist-upgrade -y | |
| echo "=== Cleaning up ===" | |
| apt autoclean -y | |
| apt autoremove -y | |
| # Check if a reboot is required | |
| if [ -f /var/run/reboot-required ]; then | |
| echo "*** Reboot required ***" | |
| fi | |
| echo "=== Update complete ===" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment