Premium
BASH Snippets.

Curated list of production-ready BASH scripts and coding solutions.

BASH

Automate Cleanup of Project Directories

Efficiently clean up common project artifacts like `node_modules`, `dist`, `build`, and `vendor` directories across multiple subdirectories to free up disk space.

View Snippet →
BASH

Clean Up Stale Git Branches

Automate the deletion of local Git branches that have already been merged into your main development branch, helping to keep your repository clean and manageable.

View Snippet →
BASH

Real-time Log Monitoring for Errors

Continuously monitor a specified log file for the occurrence of error messages or custom keywords, providing real-time alerts for debugging and system health checks.

View Snippet →
BASH

Backup Critical Configuration Files

Create timestamped tar.gz backups of important configuration files or directories, ensuring you have a restore point before making system-level changes.

View Snippet →
BASH

Quick Local HTTP Server for Static Files

Launch a temporary local HTTP server using Python's http.server module to serve static files from your current directory, perfect for front-end development.

View Snippet →
BASH

Automate Simple Website Deployment with Git and Service Restart

Create a bash script to automate website deployment by pulling the latest code from Git and restarting a configured web service or application process.

View Snippet →
BASH

Manage Environment Variables for Different Environments

Dynamically load environment variables from different .env files (e.g., .env.development, .env.production) using bash for consistent configuration across environments.

View Snippet →
BASH

Automate Log File Rotation and Compression

Implement a bash script to automatically rotate, compress, and archive web server or application log files, optimizing disk usage and simplifying log management.

View Snippet →
BASH

Automating Database Backups with mysqldump and Compression

Learn to automate database backups for MySQL/MariaDB using 'mysqldump', compressing the output with 'gzip' and timestamping files for robust data preservation.

View Snippet →
BASH

Automated SSL Certificate Expiration Check and Notification

Monitor SSL/TLS certificate expirations for your domains with Bash. This script checks certificate validity and sends email notifications if they are nearing expiry.

View Snippet →
BASH

Parsing INI-like Configuration Files in Bash

Parse INI-style configuration files in Bash to load key-value pairs into script variables, supporting sections, comments, and dynamic configuration loading.

View Snippet →
BASH

Deploying Static Website via rsync with Exclusions and Dry Run

Automate static website deployments with 'rsync', using powerful features like file exclusions, deletion of old files, and a 'dry run' mode for safe synchronization.

View Snippet →