Posts by BashSnippets

@BashSnippets

BashSnippets

Building a free bash script library. One script at a time | https://bashsnippets...
North America bashsnippets.xyz Joined May 2026
2.8k Points48 Badges3 Connections4 Followers23 Following

Posts by BashSnippets

BashSnippets in Articles 4 min read
Level: Intermediate · Time: 6 min · Outcome: A deploy that waits for its dependencies instead of racing them I once spent forty minutes at eleven at night debugging a deploy that wasn't broken. The release script ran the database migration, the migr...
post-cover-21730
BashSnippets in Articles 4 min read
My Backup Hadn't Run in 9 Days and Nothing Told Me Level: Intermediate · Time: 5 min · Outcome: A cron command that can't hang forever The backup ran fine every night for fourteen months, and then it didn't run for nine days, and nothing told me. ...
post-cover-21384
BashSnippets in Articles 6 min read
> Bash variables are global by default, so a helper function clobbered the caller's path variable and rm -rf cleaned up the wrong directory. local, return-as-status, and getopts — all in one incident. Tags: #bash #linux #scripting #devops The ...
post-cover-21095
BashSnippets in Articles 6 min read
We kept a plaintext file of hostnames, one per line, and a monitoring script read the file and pinged each host every five minutes. When a host failed to respond, the script sent an email alert. The system had been running for months and it worked — ...
post-cover-20988
BashSnippets in Articles 6 min read
The nightly backup looped over for f in $ls /data/exports and copied each file to a backup volume. It exited clean every night. For three weeks, green exit codes, no errors, nothing in the logs to suggest anything was wrong. The backup script had bee...
post-cover-20946
BashSnippets in Articles 3 min read
The backup ran every night at 2am and emailed me a green "847 files archived" summary. I'd built it, tested it against my own home directory where every file was named like report2024.csv, watched it sail through, and shipped it. For weeks the summar...
post-cover-20592
BashSnippets in Articles 4 min read
For three weeks a deployment pipeline reported every step green and shipped a build that had failed to compile on every single run. The build step ended in npm run build | tee build.log so the output could be archived. That pipe is the whole story: b...
post-cover-20433
BashSnippets in Articles 5 min read
A client handed me SSH access to a server they'd been running for two years. No documentation. No handoff notes. No "here's what's running and why." Just a root password in a LastPass share and a Slack message that said "it hosts our web app, let us...
post-cover-19992
BashSnippets in Articles 5 min read
certbot had been running quietly on my server for almost two years without a single issue. Automatic renewals. Silent cron job. I never thought about it. Set it up once, tested it once, and mentally moved it to the "solved" column of my infrastructu...
post-cover-19878
BashSnippets in Articles 3 min read
Here's a script that will ruin your day: !/bin/bash cd /nonexistent/folder rm -rf echo "Done" The cd fails because the folder doesn't exist. Bash ignores the failure. rm -rf runs in whatever directory you were already in. The script prints "Done...
post-cover-19616
BashSnippets in Articles 3 min read
I used to open files to search for things. A config had the wrong database host somewhere. I knew it was in one of the files in /etc/nginx/ but I didn't know which one. So I opened nginx.conf. Searched. Not there. Opened sites-available/default. Sea...
post-cover-19376
BashSnippets in Articles 3 min read
Every time I SSH into a server, the first thing I want to know is: how's it doing? Not a deep dive. Not a monitoring dashboard. Just the basics: how long has it been running, how much RAM is left, is the disk getting full, what's the IP. Five things...
BashSnippets in Articles 2 min read
My project folder used to look like this: new-site/ new-site-2/ new-site-final/ new-site-final-ACTUAL/ test-backup/ backup-old/ Yours probably looks similar. We've all been there. You start a project, name the folder something reasonable, and then...
post-cover-19186
BashSnippets in Articles 6 min read
I have lost work exactly once. It was a side project. A static site I'd been building over a weekend. I was reorganizing the folder structure, running mv commands to shuffle things around, and I fat-fingered a path. Moved an entire directory into a ...
post-cover-19015
BashSnippets in Articles 4 min read
Nginx crashed on a Saturday night. An OOM kill, probably — I was running a Node app that leaked memory like a broken faucet. The service went down at 2:14 AM. I found out at 8:30 AM when I opened my laptop and saw Slack messages from six hours earlie...
post-cover-18487
BashSnippets in Articles 3 min read
It was a WordPress site on a $5 DigitalOcean droplet. Client's small business. Nothing fancy. I had SSH access. I had root. I had every tool I needed to set up automated backups. I just... didn't. Because it was a small site. Because I'd "get to it ...
post-cover-18480
BashSnippets in Articles 2 min read
$? holds the exit code of the last command that ran. You've seen it. You've probably checked it. What you might not have is a reliable reference for what each value actually means — and more importantly, what to do about it in your script. Here's t...
post-cover-16902
BashSnippets in Articles 2 min read
Let me be honest about how BashSnippets started. . . I wasn't trying to build a brand. I was just tired of opening the same Stack Overflow threads every time I needed to check disk space, clean up old logs, or back up a folder. The scripts weren't ...
post-cover-16878
BashSnippets in Articles 1 min read
I kept running into the same problem while working in Linux and dev environments. The small intricacies between zsh and bash hit me at the worst time.... every time. When in need of a Bash command, I’d end up doing the same cycle: Open Google Searc...
BashSnippets in Articles 1 min read
My disk hit 100% on a Thursday night. Just a silent crash and a bunch of errors I found the next day. I had nothing running in the background watching for problems. 1. Disk space warning The script I needed before that Thursday happened. #!/bin/ba...
chevron_left

Latest Jobs

View all jobs →