Handy Linux maintenance scripts to make system administration easier from the terminal. Originally written for Zorin OS and other Debian-based distributions.
This collection provides convenient terminal tools for:
- Quick access to detailed hardware information
- Automated system updates and cleanup
These scripts are designed for Ubuntu-based Linux distributions, including:
- Ubuntu (20.04 LTS and later)
- Zorin OS
- Linux Mint
- Elementary OS
- Pop!_OS
- Any other Debian/Ubuntu-based distribution using
aptpackage manager
The scripts use apt for package management, so they are not compatible with distributions using dnf (Fedora, RHEL) or pacman (Arch).
These scripts require the following packages to be installed:
sudo apt install lshw dmidecodeDisplays comprehensive hardware and system information in one command.
Displays:
- System information (kernel version, OS, architecture)
- Hardware bus information
- BIOS and system enclosure details
- CPU information (cores, cache, frequency)
- Memory usage and availability
- Disk usage information
- Network interface information
Features:
- Error handling: stops on first error
- Privilege verification: ensures it's run with sudo
- Clean formatted output with visual section separators
Usage:
sudo showhardware.shNote: The script must be run with
sudoand will verify privileges before proceeding.
Automated system update and maintenance script. Performs package updates, cleanup, and refreshes Snap/Flatpak packages if installed.
Performs:
- Package list updates (
apt update) - System upgrades (
apt upgrade) - Unused package cleanup (
apt autocleanandapt autoremove) - Snap package refresh (if installed)
- Flatpak package upgrade (if installed)
Features:
- Error handling: stops on first error
- Privilege verification: ensures it's run with sudo
- Detailed status messages
- Automated dependency cleanup (may override some APT safety checks; review changes carefully before proceeding)
Usage:
sudo checkforupdates.shNote: The script must be run with
sudoand will verify privileges before proceeding.
-
Clone or extract files into a directory:
mkdir -p ~/scripts cd ~/scripts # Copy files here or git clone
-
Make scripts executable:
chmod +x ~/scripts/*.sh
-
Add directory to PATH (choose one method):
Option A: Bash (for ~/.bashrc)
echo 'export PATH=~/scripts:$PATH' >> ~/.bashrc source ~/.bashrc
Option B: Bash Profile (for ~/.bash_profile)
echo 'export PATH=~/scripts:$PATH' >> ~/.bash_profile source ~/.bash_profile
Option C: System-wide (requires sudo)
for f in "$HOME"/scripts/*.sh; do sudo ln -s "$f" "/usr/local/bin/$(basename "$f" .sh)" done
-
Verify installation:
sudo showhardware.sh
Run scripts from any terminal window:
# Show hardware information (requires sudo)
sudo showhardware.sh
# Update the system (requires sudo)
sudo checkforupdates.shScripts not found after installation:
- Verify PATH was updated:
echo $PATH | grep scripts - Restart terminal for changes to take effect
- Try opening a new terminal window
"Permission denied" errors:
- Ensure scripts are executable:
chmod +x ~/scripts/*.sh - For system-wide installation, you need sudo
"sudo: command not found":
- Verify script is in a directory in your PATH:
which showhardware.sh - Add the directory to PATH (see Installation section)
lshw or dmidecode commands not found:
- Install required packages:
sudo apt install lshw dmidecode
checkforupdates.sh exits early:
- The script uses error handling and stops on first error
- Check the output for which command failed
- Review system logs if needed:
journalctl -xe
Remove installed scripts:
rm ~/scripts/showhardware.sh ~/scripts/checkforupdates.shRemove from PATH (if using ~/.bashrc or ~/.bash_profile):
# Edit ~/.bashrc or ~/.bash_profile and remove the PATH line
sudo vi ~/.bashrc
# Find and delete: export PATH=~/scripts:$PATHThese scripts were enhanced with assistance from GitHub Copilot, an AI-powered code assistant. Improvements include error handling, security checks, better formatting, and additional functionality.