A smart, safe, and fully automated system maintenance script for Ubuntu & Debian systems.
Automatically:
- Uses
apt-fast(if available) for lightning-fast updates - Checks disk space & internet speed
- Updates, upgrades, cleans, and fixes broken packages
- Streams live command output to your console by default, and logs everything with colors and timestamps
- Asks for confirmation before dangerous actions
- Supports quick mode, quiet mode, and forced
aptfallback
Perfect for servers, desktops, and daily drivers!
- Smart
apt-fastauto-install & fallback toapt - Verbose by default — see exactly what apt/apt-fast is doing in real time
- Full colored console + detailed log file
- Disk space warning before proceeding
- Optional internet speed test
- Reboot prompt if kernel was updated
- Clean, modular, and well-documented code
- Zero dependencies beyond standard Ubuntu tools
# Download and run (one-liner)
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/KarthikUdyawar/ubuntu-maintenance/main/maintenance.sh)"Or clone and run:
git clone https://github.com/KarthikUdyawar/ubuntu-maintenance.git
cd ubuntu-maintenance
chmod +x maintenance.sh
sudo ./maintenance.shsudo ./maintenance.sh # Full interactive mode (verbose by default)
sudo ./maintenance.sh --quick # Skip speed test
sudo ./maintenance.sh --apt # Force use of apt (no apt-fast)
sudo ./maintenance.sh --quiet # Suppress live command output (log file only)Flags can be combined, e.g. sudo ./maintenance.sh --quick --apt --quiet.
By default the script streams apt/apt-fast output live to your terminal as it runs, in addition to writing it to the log file — so you can see exactly what's happening during updates and upgrades. Pass --quiet to go back to the old behavior of logging silently to file only.
Under the hood, in order:
| Step | Command |
|---|---|
| Package manager install (if missing, opt-in) | add-apt-repository ppa:apt-fast/stable, apt install -y apt-fast |
| Update package lists | apt-fast update (or apt update) |
| Speed test (optional) | apt-fast install -y speedtest-cli, speedtest-cli --simple |
| Show upgradable packages | apt list --upgradable |
| Upgrade packages | apt-fast upgrade -y |
| Full upgrade | apt-fast full-upgrade -y |
| Check package integrity | apt-fast check |
| Fix broken dependencies | apt-fast -f install -y |
| Remove unnecessary packages | apt-fast autoremove --purge -y |
| Clean package cache | apt-fast autoclean -y, apt-fast clean |
| Reboot (if required, opt-in) | shutdown -r now |
Swap apt-fast for apt in the table above when running with --apt or when apt-fast isn't installed.
All actions are logged to:
/var/log/system_maintenance_YYYYMMDD_HHMMSS.log
Made with ❤️ by Karthik Udyawar
MIT License – Free to use, modify, and distribute.