Premium
BASH Snippets.

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

BASH

Git: Create and Push New Feature Branch from Development

A Bash script to automate the common Git workflow of creating a new feature branch from the 'development' branch, switching to it, and pushing it to the remote repository.

View Snippet →
BASH

Clear Common Web Project Cache Directories

A Bash script to quickly clear common cache and temporary directories for various web development projects (e.g., Laravel, Node.js builds) to resolve stale data issues.

View Snippet →
BASH

Check Website Uptime and Send Alert

A Bash script to continuously monitor a website's availability, checking its HTTP status code, and sending an email alert if it's detected as down.

View Snippet →
BASH

Automated MySQL/PostgreSQL Database Backup

A robust Bash script to automate daily backups of a MySQL or PostgreSQL database, compress the dumps, and manage retention of old backups.

View Snippet →
BASH

Deploy Static Website Files with rsync

A simple Bash script to efficiently deploy local static website files to a remote server using rsync, ensuring only changed files are transferred.

View Snippet →
BASH

Automate Git Pull and Service Restart

A simple bash script to automate pulling the latest code from a Git repository and restarting a web service, ideal for basic deployment workflows.

View Snippet →
BASH

Read and Process File Line by Line

A bash script to efficiently read and process text files line by line, useful for parsing logs, configuration files, or lists of data for web development tasks.

View Snippet →
BASH

Check if a Port is in Use

A practical bash script to determine if a specific TCP port is currently being listened on, essential for debugging network issues or starting services.

View Snippet →
BASH

Basic Log Archiving with Date Stamping

A bash script to automate the archiving of log files by date-stamping them and optionally compressing, helping manage server disk space and log history.

View Snippet →
BASH

Batch Download Files from a List of URLs

Automate downloading multiple files from a list of URLs using `wget` in a bash script, ideal for bulk content retrieval and asset management.

View Snippet →
BASH

Automate Full Website and Database Backups

Automate full website backups, including files and MySQL database, with timestamped archives for easy restoration and disaster recovery.

View Snippet →
BASH

Monitor Web Server Logs for Errors

Continuously monitor web server log files in real-time for specific error messages or keywords, enabling immediate detection of critical issues.

View Snippet →