Premium
BASH Snippets.

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

BASH

Automate Web Project File Permissions (chmod/chown)

Secure web directories and files by automating correct permissions. This bash script sets common `chmod` and `chown` settings for web server users.

View Snippet →
BASH

Parse JSON with jq for API Responses or Config

Efficiently parse and extract specific data from JSON responses or configuration files using the powerful 'jq' command-line tool in Bash scripting.

View Snippet →
BASH

Execute Authenticated HTTP Requests with cURL

Perform advanced HTTP requests in Bash using 'curl', including sending custom headers, JSON bodies, and handling authentication for API interactions.

View Snippet →
BASH

Git Workflow: Check Status & Stage Files

Streamline your Git workflow with a Bash script to quickly check repository status, view diffs, and interactively stage specific files for commit.

View Snippet →
BASH

Extract Specific Data from Log Files using Awk

Efficiently parse and extract specific fields or patterns from large log files using 'awk', making it easier to analyze and debug web application issues.

View Snippet →
BASH

Find and Terminate Processes by Name or Port

Learn to locate and gracefully stop running processes, like local development servers, using 'ps', 'grep', 'pgrep', and 'kill' commands in Bash.

View Snippet →
BASH

Automating Daily MySQL/PostgreSQL Database Backups

Create timestamped, compressed backups of your database (MySQL or PostgreSQL) daily. This script automates backup generation and retention policy, removing old files.

View Snippet →
BASH

Efficiently Syncing Local Files to a Remote Server with Rsync

Leverage rsync for fast, incremental file synchronization to deploy web application updates or backups to a remote server, saving bandwidth and time.

View Snippet →
BASH

Real-time Monitoring of Apache/Nginx Error Logs for Critical Issues

Monitor web server error logs (Apache or Nginx) in real-time, filtering for critical error messages to quickly identify and respond to production issues.

View Snippet →
BASH

Basic Health Check for a Web Service URL

Perform a simple yet effective health check on a web service URL, verifying its reachability and successful HTTP status, with optional retries.

View Snippet →
BASH

Unified Script for Clearing Application Caches (e.g., Laravel, Node.js)

Streamline your development workflow with a flexible bash script to clear various application caches (Laravel, Node.js, Composer) based on project type.

View Snippet →
BASH

Loading Environment Variables from .env File

A bash script to efficiently load key-value pairs from a .env file into the current shell's environment, streamlining application configuration.

View Snippet →