595 B
595 B
#!/bin/bash
# Ensure the script is run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Please use sudo."
exit 1
fi
echo "--- Updating package lists ---"
apt update
echo "--- Upgrading installed packages ---"
DEBIAN_FRONTEND=noninteractive apt upgrade -y
echo "--- Performing distribution upgrade (if available) ---"
DEBIAN_FRONTEND=noninteractive apt full-upgrade -y
echo "--- Cleaning up unnecessary packages ---"
apt autoremove -y
echo "--- Cleaning up cached package files ---"
apt clean
echo "--- Linux system update and cleanup complete! ---"