Premium
BASH Snippets.

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

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 →
BASH

Automate Simple Web Application Deployment

Streamline web application deployment by automating Git pull, installing project dependencies, and restarting web server services.

View Snippet →
BASH

Clean Up Old Build Artifacts and Cache Files

Automate cleanup of old build artifacts, temporary files, or cache directories in web projects to free up disk space and maintain tidiness.

View Snippet →
BASH

Check if a Network Port is Open and Listening

Quickly verify if a specific network port on a server or localhost is open and actively listening, crucial for debugging network services.

View Snippet →
BASH

Automate Daily Database Backups (MySQL Example)

Safeguard your data with a bash script that performs daily MySQL database backups, compresses them, and timestamps the archives for easy recovery.

View Snippet →
BASH

Automate Git Pull, Dependencies, and Service Restart for Deployment

Streamline your web application deployment with a bash script that pulls the latest Git changes, installs dependencies, and restarts your service efficiently.

View Snippet →
BASH

Monitor Disk Space and Send Email Alerts in Bash

Keep your web servers healthy by monitoring disk usage with a bash script that sends email notifications when space falls below a critical threshold.

View Snippet →
BASH

Automate Log File Rotation and Archiving with Bash

Efficiently manage server log files using a bash script that rotates, compresses, and archives old logs to save disk space and maintain order.

View Snippet →