A personal collection of bash scripts for system administration and automation. Each script handles specific tasks like package updates, system maintenance, and environment setup.
Clone or download the repository, then run scripts with:
bash script-name.sh
# OR (if executable):
./script-name.shMost scripts require:
- Bash 4+ — Verify with
bash --version - sudo access — Many operations require elevated privileges
- Package manager —
apt(Debian/Ubuntu) and optionallyflatpak
Before running any script, review its documentation below to understand what it does and what permissions it needs.
Purpose: System package updates and cleanup
Frequency: Daily
Requires: sudo, apt
Updates all system packages (apt, apt-get dependencies, optionally flatpak) and performs system cleanup:
- Updates package lists and upgrades packages
- Performs full system upgrade
- Removes unused packages and cleans package cache
- Updates flatpak apps (if installed)
Usage:
sudo bash daily_update.sh
# OR if you prefer with full path:
cd /path/to/Script-Hub && sudo bash daily_update.shWhat it does:
sudo apt update -y— Refresh package listssudo apt upgrade -y— Upgrade all packagessudo apt full-upgrade -y— Full system upgradesudo apt autoremove -y— Remove unused packagessudo apt clean— Clean package cacheflatpak update -y— Update flatpak apps (if installed)
Note: All operations are non-interactive (-y flags). Run with DRY_RUN=1 to preview without executing (if implemented).
Purpose: Install NVIDIA drivers on Ubuntu/Debian systems
Frequency: As-needed
Requires: sudo, lspci (pciutils), ubuntu-drivers-common
Quickly installs NVIDIA drivers on AWS EC2 instances and bare metal machines with NVIDIA GPUs.
Usage:
sudo bash install_nvidia_drivers.shWhat it does:
- Detects NVIDIA GPU using
lspci— exits if no GPU found sudo apt update -y— Refresh package listssudo apt upgrade -y— Upgrade all packages- Installs
ubuntu-drivers-commonif missing sudo ubuntu-drivers --gpgpu install— Install NVIDIA drivers- Displays reboot instructions
After running: Manually reboot your system and verify installation:
sudo reboot
# After reboot:
nvidia-smiImportant:
⚠️ This script requires an NVIDIA GPU — it exits immediately if no GPU is detected⚠️ Drivers require a system reboot to activate — they will not work until after reboot- Use
nvidia-smiafter rebooting to verify drivers are installed and working
Purpose: Docker Engine installation and sudo-less access configuration
Frequency: As-needed
Requires: sudo, curl, internet connection
Installs Docker Engine on any Linux instance by downloading and executing Docker's official installer script, then automatically configures the current user to run docker commands without sudo. After installation, the script automatically spawns a new shell where you can immediately test docker.
Usage:
sudo bash install_docker.shWhat it does:
- Downloads Docker's official installation script from
get.docker.com - Executes the installer to set up Docker Engine, Buildx, Compose, and all dependencies
- Cleans up the temporary installer file
- Adds the current user to the
dockergroup for sudo-less access - Verifies docker group access automatically with
sg docker - Automatically spawns a new shell where docker is ready to use
- Displays fallback instructions if automation isn't available
After running: The script will automatically open a docker-ready shell where you can immediately test:
# In the automatically spawned shell:
docker --version
docker ps
# Any docker command works without sudoThen type exit to return to the original shell.
Future terminals: All new terminal windows will also have docker access automatically (no additional steps needed).
If the script can't automatically spawn a shell: You can manually activate docker group membership:
Option 1 - Activate in current shell (temporary, this session only):
newgrp docker
docker --version # Now works without sudo in this shellOption 2 - Permanent (recommended):
logout # Log out completely
# Then log back in
docker --version # Now works without sudo in all new shellsImportant:
⚠️ This script downloads and executes Docker's official installer — review Docker's installation docs for details⚠️ Security: Users in the docker group can run containers with root privileges. Only add trusted users to the docker group.- Works on any Linux distribution (Debian, Ubuntu, CentOS, Fedora, etc.)
- Requires internet connection to download the installer
- The automatic shell spawn feature requires the
sgutility (standard on all Linux systems)
- Create a file with
.shextension following naming convention (lowercase, hyphens):backup-home.sh - Start with safety header:
#!/bin/bash set -e
- Include a comment describing the script's purpose and requirements
- Add progress messages for each significant step
- Test locally in a non-production environment
- Update this README with script description, usage, and prerequisites
- Commit with clear message
All scripts follow these principles:
- Safety first:
set -eexits on errors,set -o pipefailcatches pipe failures - User feedback: Progress messages at each step, timestamps for long operations
- Explicit dependencies: Commands verified before use, requirements documented
- Error handling: Informative error messages to stderr, cleanup on exit
- Testing: Support dry-run mode for destructive operations where practical
For detailed conventions, patterns, and examples, see .github/copilot-instructions.md.
Use the /new-script prompt to generate a new script from a task description. It will create a template with safety practices, logging, and error handling built in.
When reviewing or modifying scripts, check .github/instructions/shell-scripts.instructions.md for the full safety and style checklist.
daily_update.sh— Daily system updates and cleanupinstall_nvidia_drivers.sh— NVIDIA driver installation for AWS EC2 / bare metalinstall_docker.sh— Docker Engine installation for any Linux instance- .github/copilot-instructions.md — Detailed development guide and conventions
- .github/prompts/new-script.prompt.md — Script generation prompt
- .github/instructions/shell-scripts.instructions.md — Review checklist for scripts