Skip to content

Alptimus/Script-Hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Script-Hub

A personal collection of bash scripts for system administration and automation. Each script handles specific tasks like package updates, system maintenance, and environment setup.

Quick Start

Clone or download the repository, then run scripts with:

bash script-name.sh
# OR (if executable):
./script-name.sh

Prerequisites

Most scripts require:

  • Bash 4+ — Verify with bash --version
  • sudo access — Many operations require elevated privileges
  • Package managerapt (Debian/Ubuntu) and optionally flatpak

Before running any script, review its documentation below to understand what it does and what permissions it needs.

Scripts

daily_update.sh

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.sh

What it does:

  1. sudo apt update -y — Refresh package lists
  2. sudo apt upgrade -y — Upgrade all packages
  3. sudo apt full-upgrade -y — Full system upgrade
  4. sudo apt autoremove -y — Remove unused packages
  5. sudo apt clean — Clean package cache
  6. flatpak 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).

install_nvidia_drivers.sh

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.sh

What it does:

  1. Detects NVIDIA GPU using lspci — exits if no GPU found
  2. sudo apt update -y — Refresh package lists
  3. sudo apt upgrade -y — Upgrade all packages
  4. Installs ubuntu-drivers-common if missing
  5. sudo ubuntu-drivers --gpgpu install — Install NVIDIA drivers
  6. Displays reboot instructions

After running: Manually reboot your system and verify installation:

sudo reboot
# After reboot:
nvidia-smi

Important:

  • ⚠️ 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-smi after rebooting to verify drivers are installed and working

install_docker.sh

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.sh

What it does:

  1. Downloads Docker's official installation script from get.docker.com
  2. Executes the installer to set up Docker Engine, Buildx, Compose, and all dependencies
  3. Cleans up the temporary installer file
  4. Adds the current user to the docker group for sudo-less access
  5. Verifies docker group access automatically with sg docker
  6. Automatically spawns a new shell where docker is ready to use
  7. 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 sudo

Then 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 shell

Option 2 - Permanent (recommended):

logout  # Log out completely
# Then log back in
docker --version  # Now works without sudo in all new shells

Important:

  • ⚠️ 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 sg utility (standard on all Linux systems)

Development

Adding New Scripts

  1. Create a file with .sh extension following naming convention (lowercase, hyphens): backup-home.sh
  2. Start with safety header:
    #!/bin/bash
    set -e
  3. Include a comment describing the script's purpose and requirements
  4. Add progress messages for each significant step
  5. Test locally in a non-production environment
  6. Update this README with script description, usage, and prerequisites
  7. Commit with clear message

Script Conventions

All scripts follow these principles:

  • Safety first: set -e exits on errors, set -o pipefail catches 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.

Generating Scripts

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.

Code Review Checklist

When reviewing or modifying scripts, check .github/instructions/shell-scripts.instructions.md for the full safety and style checklist.


Files

About

An AIO Script repository which I use daily.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages