<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Anguishe</title>
    <description>The latest articles on Forem by Anguishe (@bashsnippets).</description>
    <link>https://forem.com/bashsnippets</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3909567%2F885dee1e-f72c-48d7-965f-91ee8ade012a.jpeg</url>
      <title>Forem: Anguishe</title>
      <link>https://forem.com/bashsnippets</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bashsnippets"/>
    <language>en</language>
    <item>
      <title>I Built a Free Tools Directory for Linux Users Who Are Tired of Googling the Same Commands</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Thu, 07 May 2026 20:51:35 +0000</pubDate>
      <link>https://forem.com/bashsnippets/i-built-a-free-tools-directory-for-linux-users-who-are-tired-of-googling-the-same-commands-2e27</link>
      <guid>https://forem.com/bashsnippets/i-built-a-free-tools-directory-for-linux-users-who-are-tired-of-googling-the-same-commands-2e27</guid>
      <description>&lt;h2&gt;
  
  
  The Problem I Keep Running Into
&lt;/h2&gt;

&lt;p&gt;I've written the same bash script scaffolding at least 40 times. Every time I spin up a new automation, I start from scratch: add the shebang, remember the &lt;code&gt;set -euo pipefail&lt;/code&gt; line, define variables, write the same error-handling block I always use, forget to add a usage message until the third time I run it wrong.&lt;/p&gt;

&lt;p&gt;And don't get me started on chmod. I Google "chmod 755 vs 644" at least once a month, even though I &lt;em&gt;know&lt;/em&gt; what it means. The octal-to-permission mapping just doesn't stick unless you're using it every single day.&lt;/p&gt;

&lt;p&gt;So I built something to fix both of those problems — and it's turning into a whole directory of tools.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built: bashsnippets.xyz/tools
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools" rel="noopener noreferrer"&gt;bashsnippets.xyz/tools&lt;/a&gt;&lt;/strong&gt; is a free directory of interactive tools for Linux users and developers. No signup. No rate limits. Works in the browser. Copy and go.&lt;/p&gt;

&lt;p&gt;Right now it has two tools live, with a new one shipping every week:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. chmod Permissions Builder
&lt;/h3&gt;

&lt;p&gt;Click checkboxes for read/write/execute across owner/group/others. Get the exact &lt;code&gt;chmod&lt;/code&gt; command instantly — both octal and symbolic — with a plain-English explanation.&lt;/p&gt;

&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;755 filename
&lt;span class="nb"&gt;chmod &lt;/span&gt;&lt;span class="nv"&gt;u&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;rwx,g&lt;span class="o"&gt;=&lt;/span&gt;rx,o&lt;span class="o"&gt;=&lt;/span&gt;rx filename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Owner:&lt;/strong&gt; read + write + execute&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Group:&lt;/strong&gt; read + execute&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Others:&lt;/strong&gt; read + execute&lt;/p&gt;

&lt;p&gt;If you've ever second-guessed whether a script needs 755 or 744, this eliminates the lookup step permanently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/chmod-permissions-builder.html" rel="noopener noreferrer"&gt;→ Try the chmod builder&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Bash Boilerplate Generator
&lt;/h3&gt;

&lt;p&gt;Pick your script type (automation, backup, monitoring, deployment), toggle options (error handling, logging, dry-run mode, help message), optionally inject a snippet from the library, and get a production-ready &lt;code&gt;.sh&lt;/code&gt; template with everything wired up.&lt;/p&gt;

&lt;p&gt;No more blank files. No more copying the same header block from your last script.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/bash-boilerplate-generator.html" rel="noopener noreferrer"&gt;→ Try the boilerplate generator&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Coming Next
&lt;/h2&gt;

&lt;p&gt;I'm shipping a new tool every week. The queue right now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cron Job Builder&lt;/strong&gt; — visual cron syntax builder with plain-English output&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exit Code Lookup&lt;/strong&gt; — paste an exit code, get the meaning instantly&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;systemd Unit File Generator&lt;/strong&gt; — build service files without memorizing the spec&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each one solves a specific "I always Google this" problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Built This (and Why It's Free)
&lt;/h2&gt;

&lt;p&gt;I got tired of opening 6 Stack Overflow tabs every time I needed to do something I'd done 20 times before. These aren't complex problems — they're just pattern-matching tasks where the syntax is annoying to remember.&lt;/p&gt;

&lt;p&gt;The tools are free because:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;They're simple enough that paywalling them would be ridiculous&lt;/li&gt;
&lt;li&gt;I want them to be genuinely useful, not VC-funded SaaS bloat&lt;/li&gt;
&lt;li&gt;The snippet library (which the tools complement) has always been free&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There's no business model. Just a side project that scratches an itch I have, and apparently a lot of other people have too based on the YouTube Shorts I've been posting.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools" rel="noopener noreferrer"&gt;bashsnippets.xyz/tools&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you spot bugs, missing features, or have ideas for new tools, drop a comment. I'm building this in public and genuinely want feedback from people who actually use bash day-to-day.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Stop Guessing 'chmod' I Built a Free Visual Permissions Builder for Linux</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Thu, 07 May 2026 20:31:05 +0000</pubDate>
      <link>https://forem.com/bashsnippets/stop-guessing-chmod-i-built-a-free-visual-permissions-builder-for-linux-2m1a</link>
      <guid>https://forem.com/bashsnippets/stop-guessing-chmod-i-built-a-free-visual-permissions-builder-for-linux-2m1a</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;You're about to deploy a script. You know you need the file executable, but readable only by the owner. You type &lt;code&gt;chmod 754&lt;/code&gt;... or was it &lt;code&gt;744&lt;/code&gt;? Maybe &lt;code&gt;755&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;You Google it. You find a Stack Overflow thread from 2011. You get it wrong anyway.&lt;/p&gt;

&lt;p&gt;chmod's octal notation is one of those things every Linux user has to look up every single time — and the mental model for &lt;em&gt;why&lt;/em&gt; &lt;code&gt;755&lt;/code&gt; means what it means isn't obvious unless you've memorized the bit table.&lt;/p&gt;

&lt;p&gt;I built a tool to fix that permanently.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Tool: chmod Permissions Builder
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/chmod-permissions-builder.html" rel="noopener noreferrer"&gt;bashsnippets.xyz/tools/chmod-permissions-builder.html&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's a free, no-login, browser-based tool. You click checkboxes for &lt;strong&gt;Owner&lt;/strong&gt;, &lt;strong&gt;Group&lt;/strong&gt;, and &lt;strong&gt;Others&lt;/strong&gt; — read, write, execute — and it instantly generates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;chmod&lt;/code&gt; octal command (&lt;code&gt;chmod 755 filename&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;The symbolic command (&lt;code&gt;chmod u=rwx,g=rx,o=rx filename&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;A plain-English explanation of what those permissions mean&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No ads walls. No email required. Copy and go.&lt;/p&gt;




&lt;h2&gt;
  
  
  How chmod Permissions Actually Work
&lt;/h2&gt;

&lt;p&gt;Before we get to the tool output, here's the bit math that makes it click once:&lt;/p&gt;

&lt;p&gt;Each permission set (owner / group / others) is a 3-bit binary number:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Permission&lt;/th&gt;
&lt;th&gt;Binary&lt;/th&gt;
&lt;th&gt;Octal&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;---&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;000&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--x&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;001&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-w-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;010&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-wx&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;011&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;r--&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;r-x&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rw-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rwx&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;111&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So &lt;code&gt;chmod 755&lt;/code&gt; means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;7&lt;/strong&gt; = owner gets &lt;code&gt;rwx&lt;/code&gt; (read + write + execute)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;5&lt;/strong&gt; = group gets &lt;code&gt;r-x&lt;/code&gt; (read + execute, no write)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;5&lt;/strong&gt; = others get &lt;code&gt;r-x&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it. Once you see it as binary, it's never confusing again. The tool builds this table live as you click.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Permission Combos
&lt;/h2&gt;

&lt;p&gt;Here are the most-used values and what they're for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;755 script.sh      &lt;span class="c"&gt;# Executable script — owner can edit, others can run&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;644 config.conf    &lt;span class="c"&gt;# Config file — owner can edit, others read-only&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;600 .ssh/id_rsa    &lt;span class="c"&gt;# Private key — owner only, no one else&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;777 /tmp/shared    &lt;span class="c"&gt;# Fully open (use sparingly, never on production)&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;700 ~/scripts/     &lt;span class="c"&gt;# Private directory — owner only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How to Apply Permissions Recursively
&lt;/h2&gt;

&lt;p&gt;The builder outputs a single-file command. If you need to apply permissions across a whole directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Apply 755 to all directories, 644 to all files&lt;/span&gt;
find /var/www/html &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;chmod &lt;/span&gt;755 &lt;span class="o"&gt;{}&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
find /var/www/html &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;chmod &lt;/span&gt;644 &lt;span class="o"&gt;{}&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use the &lt;code&gt;-R&lt;/code&gt; flag (with care):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; 755 /var/www/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ Never run &lt;code&gt;chmod -R 777&lt;/code&gt; on anything outside a throw-away sandbox. It removes all security boundaries.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Check Current Permissions Fast
&lt;/h2&gt;

&lt;p&gt;Before changing anything, inspect what's there:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; filename          &lt;span class="c"&gt;# Single file&lt;/span&gt;
&lt;span class="nb"&gt;stat &lt;/span&gt;filename            &lt;span class="c"&gt;# Verbose output including octal&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /path/to/dir/     &lt;span class="c"&gt;# Directory listing&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;stat&lt;/code&gt; shows you the octal directly — useful when you need to replicate permissions from one file to another:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;stat&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"%a"&lt;/span&gt; filename    &lt;span class="c"&gt;# Just the octal number&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Try the Tool
&lt;/h2&gt;

&lt;p&gt;If you set the wrong permissions on a web server config or SSH key, things break in ways that are slow to debug. Getting it right the first time matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/chmod-permissions-builder.html" rel="noopener noreferrer"&gt;→ Open the chmod Permissions Builder&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No login. No install. Works on mobile too.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;More free tools and copy-paste bash scripts at &lt;a href="https://bashsnippets.xyz" rel="noopener noreferrer"&gt;bashsnippets.xyz&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>terminal</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Every bash script I write starts with the same 20 lines. So I made a generator for them.</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Wed, 06 May 2026 21:00:43 +0000</pubDate>
      <link>https://forem.com/bashsnippets/every-bash-script-i-write-starts-with-the-same-20-lines-so-i-made-a-generator-for-them-4nan</link>
      <guid>https://forem.com/bashsnippets/every-bash-script-i-write-starts-with-the-same-20-lines-so-i-made-a-generator-for-them-4nan</guid>
      <description>&lt;h2&gt;
  
  
  There's a set of things every bash script should have at the top. Not "here are some nice-to-haves" — actual things that prevent real, bad, hard-to-debug failures:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail
&lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;$'&lt;/span&gt;&lt;span class="se"&gt;\n\t&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;set -e&lt;/code&gt; makes the script exit immediately if any command returns a non-zero status. Without it, your script keeps running after a failure and you get compounding errors that are confusing to trace.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;set -u&lt;/code&gt; makes the script error if you reference a variable that hasn't been set. Without it, &lt;code&gt;$MYVAR&lt;/code&gt; being undefined silently evaluates to an empty string. That empty string goes into a path. That path gets passed to &lt;code&gt;rm -rf&lt;/code&gt;. You see where this goes.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;set -o pipefail&lt;/code&gt; makes the exit status of a pipeline reflect the first failure in the chain, not just the last command. &lt;code&gt;broken_command | grep something&lt;/code&gt; would exit 0 without this flag, because &lt;code&gt;grep&lt;/code&gt; succeeded even though the input was empty.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;IFS=$'\n\t'&lt;/code&gt; prevents word splitting on spaces in filenames. Without it, a filename like &lt;code&gt;my file.txt&lt;/code&gt; gets treated as two arguments.&lt;/p&gt;

&lt;h3&gt;
  
  
  This is what I call the mandatory header. I've forgotten parts of it enough times that I stopped trying to remember it and started generating it.
&lt;/h3&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;The Boilerplate Generator&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://bashsnippets.xyz/tools/bash-boilerplate-generator.html" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  You configure:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Script identity&lt;/strong&gt; — name, description, author. These go in the comment block at the top so someone reading the script 6 months from now (probably you) knows what it's supposed to do.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Safety flags&lt;/strong&gt; — each one is a checkbox with an explanation of what it does. &lt;code&gt;set -x&lt;/code&gt; is there too for debug mode — I often add it temporarily when something isn't working, then remove it before deploying.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Features:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Timestamped &lt;code&gt;log()&lt;/code&gt; function — stops you from using raw &lt;code&gt;echo&lt;/code&gt; for output, which doesn't timestamp. When you're looking at a log file and everything just says "backup complete" with no time attached, you'll wish you had this.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CHECK&lt;/code&gt; / &lt;code&gt;CROSS&lt;/code&gt; variables — adds &lt;code&gt;CHECK="✓"&lt;/code&gt; and &lt;code&gt;CROSS="✗"&lt;/code&gt; at the top, which is the convention across all BashSnippets scripts. Consistent visual output in the terminal.&lt;/li&gt;
&lt;li&gt;Argument parser with &lt;code&gt;--help&lt;/code&gt; and &lt;code&gt;--dry-run&lt;/code&gt; — getopts-based. Dry run mode is something I use constantly during development to test a script's logic without actually writing/deleting/moving anything.&lt;/li&gt;
&lt;li&gt;Lock file — prevents duplicate runs. If you're scheduling something with cron and the job sometimes runs long, without a lock file you can end up with two instances trying to write to the same output file.&lt;/li&gt;
&lt;li&gt;Root check — exits cleanly with an error if the script isn't run as root, instead of failing halfway through with a permission error.&lt;/li&gt;
&lt;li&gt;Trap on EXIT — runs a &lt;code&gt;cleanup()&lt;/code&gt; function on exit or interruption, which you can populate with whatever teardown logic makes sense.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Snippet injection&lt;/strong&gt; — you can pull in a script from the library (disk space warning, file backup, delete old logs, etc.) and have it dropped into the body of the generated boilerplate. So you're not starting from zero — you're starting from a working script wrapped in production safety.
&lt;/h3&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What the output looks like&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  When you configure everything and click copy, you get a complete &lt;code&gt;.sh&lt;/code&gt; file: shebang, comment block, safety flags, feature code, and your injected snippet (if any) in the main logic section. There's even a source comment pointing back to bashsnippets.xyz so your team knows where the template came from.
&lt;/h3&gt;

&lt;h4&gt;
  
  
  I use this myself. Every new script starts here.
&lt;/h4&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why this exists as a tool instead of a GitHub gist&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Because I kept updating my gist as I learned new things, and then had five different versions floating around in different places. A tool with checkboxes forces me to be explicit about what I'm including and why, and the output is always current.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Try it: &lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/bash-boilerplate-generator.html" rel="noopener noreferrer"&gt;https://bashsnippets.xyz/tools/bash-boilerplate-generator.html&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Free, no login, GitHub Pages. Generates clean &lt;code&gt;.sh&lt;/code&gt; output you can paste directly into a file and start editing.
&lt;/h4&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Stop Googling "what is exit code 127" There's a better way to handle it</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Wed, 06 May 2026 20:57:35 +0000</pubDate>
      <link>https://forem.com/bashsnippets/stop-googling-what-is-exit-code-127-theres-a-better-way-to-handle-it-53je</link>
      <guid>https://forem.com/bashsnippets/stop-googling-what-is-exit-code-127-theres-a-better-way-to-handle-it-53je</guid>
      <description>&lt;h2&gt;
  
  
  Exit code 127 means "command not found." I know that now. But the first dozen times I saw it, I Googled it. Every time. Because exit codes are one of those things that are fundamental to bash scripting but never feel intuitive until you've been burned by them enough.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Here's a quick table of the ones that show up constantly:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Success&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;General error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Misuse of shell built-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;126&lt;/td&gt;
&lt;td&gt;Command found but not executable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;127&lt;/td&gt;
&lt;td&gt;Command not found&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;130&lt;/td&gt;
&lt;td&gt;Script killed with Ctrl-C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;137&lt;/td&gt;
&lt;td&gt;Process killed with SIGKILL (kill -9)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;139&lt;/td&gt;
&lt;td&gt;Segmentation fault&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;143&lt;/td&gt;
&lt;td&gt;Process killed with SIGTERM&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  The rule for codes above 128: subtract 128 to get the signal number. 137 = 128 + 9 (SIGKILL). 143 = 128 + 15 (SIGTERM). Once you know that pattern, a lot of the high-numbered codes make sense.
&lt;/h4&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;But looking up the code is only half the problem&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  The other half is writing the error handler. And this is where most scripts fall short. They check &lt;code&gt;$?&lt;/code&gt; after a command, but the handler is usually something like:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; 0 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"something went wrong"&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;1
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Which tells you almost nothing when you're looking at logs at 2am.
&lt;/h4&gt;

&lt;h3&gt;
  
  
  I built a tool that generates a proper handler for any code you give it.
&lt;/h3&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Exit Code Lookup tool&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  You go to &lt;a href="https://bashsnippets.xyz/tools/bash-exit-code-lookup.html" rel="noopener noreferrer"&gt;https://bashsnippets.xyz/tools/bash-exit-code-lookup.html&lt;/a&gt;, type in a code — or click one of the common ones — and you get:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What the code means&lt;/li&gt;
&lt;li&gt;The most likely causes (this is the part that actually saves time)&lt;/li&gt;
&lt;li&gt;A copy-paste error handler in your choice of format: if/else block, case statement, or inline &lt;code&gt;||&lt;/code&gt; fallback&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The if/else output names the code explicitly, logs what failed, and exits with the same code so the calling process knows something went wrong. The case statement version is better if you're handling multiple possible outcomes. The inline &lt;code&gt;||&lt;/code&gt; is what you want when you're doing something quick and you just need a fast bail-out.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  One thing I added that I actually use myself: the quick-click buttons for the codes you see constantly. You don't have to type 127 — just click it, get the handler, copy it.
&lt;/h3&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Common situation this actually helps with&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  You're writing a script that calls a binary. You want to handle the case where the binary isn't installed (127), the case where the binary exists but fails on the input (1), and the case where someone Ctrl-C'd it (130). Those three cases need different responses — log and exit, retry with different args, clean up and exit gracefully — and the case statement the tool generates is structured for exactly that.
&lt;/h3&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;The thing I keep adding to all my scripts now&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s1"&gt;'echo "Script failed at line $LINENO with exit code $?" &amp;gt;&amp;amp;2'&lt;/span&gt; ERR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Put that near the top of any script that matters. When it fails — and things fail — you know exactly where and with what code. Pair it with the exit code lookup when you're not sure what the code means, and you cut debugging time significantly.
&lt;/h3&gt;




&lt;h4&gt;
  
  
  Try it: &lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/bash-exit-code-lookup.html" rel="noopener noreferrer"&gt;https://bashsnippets.xyz/tools/bash-exit-code-lookup.html&lt;/a&gt;&lt;/strong&gt;
&lt;/h4&gt;

&lt;h4&gt;
  
  
  No signup. All 256 codes (0-255) are in there. The handlers are copy-ready and production-quality, not the half-baked one-liners you find on random Stack Overflow answers.
&lt;/h4&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>I got tired of deploying broken cronjobs, so I built a tool that generates them properly</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Wed, 06 May 2026 20:54:04 +0000</pubDate>
      <link>https://forem.com/bashsnippets/i-got-tired-of-deploying-broken-cronjobs-so-i-built-a-tool-that-generates-them-properly-3jl6</link>
      <guid>https://forem.com/bashsnippets/i-got-tired-of-deploying-broken-cronjobs-so-i-built-a-tool-that-generates-them-properly-3jl6</guid>
      <description>&lt;h1&gt;
  
  
  Every linux user has a story. Mine is a backup script that silently failed for three weeks because the cron expression was right but the PATH wasn't set, so the script couldn't find tar. Backups looked like they were running. Nothing was actually being archived. I found out when I needed to restore a file.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  That specific failure mode — cron jobs that pass silently but don't actually do anything — is one of the most annoying problems in Linux automation because there's no obvious error. The job runs. The exit code is 0. Your logs say nothing because you didn't add logging. And now you're debugging something that happened at 2am three weeks ago.
&lt;/h1&gt;

&lt;h2&gt;
  
  
  So I built a tool.
&lt;/h2&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What it does&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Cron Job Builder at bashsnippets.xyz does three things that I always forget to do manually:
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Builds the expression visually&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  You pick minute, hour, day of month, month, and day of week from dropdowns. It assembles the expression in real time. There are also quick presets — daily 2am, every 6 hours, weekdays 9am, monthly, every 15 minutes — for the schedules you actually use 90% of the time.
&lt;/h4&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Wraps it in production-safe bash&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  This is the part that actually matters. The tool adds:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;gt;&amp;gt; /var/log/cronjob.log 2&amp;gt;&amp;amp;1&lt;/code&gt; — so stdout and stderr go somewhere you can read them later&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SHELL=/bin/bash&lt;/code&gt; — because cron's default shell is not what you think it is&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PATH=/usr/local/bin:/usr/bin:/bin&lt;/code&gt; — this is the one that burned me. Cron has a stripped-down PATH. Commands that work in your terminal fail silently in cron because the binary isn't in scope.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MAILTO=you@example.com&lt;/code&gt; — optional, but useful for catching failures you're not watching for&lt;/li&gt;
&lt;li&gt;Lock file via &lt;code&gt;flock&lt;/code&gt; — prevents a slow job from stacking on top of itself if it runs longer than the schedule interval&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Every single one of these is a checkbox. You don't have to remember them — you just check what you need.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Shows the next 10 scheduled run times&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  So you can verify the expression is actually doing what you think it's doing before you paste it into crontab.
&lt;/h4&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;You can also inject a snippet from the library&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The tool has a dropdown that lets you pull in a pre-built script from the BashSnippets library — file backup, disk space warning, delete old logs — and have it wrapped in the boilerplate automatically. So you go from "I want to back up my home directory nightly" to a full, copy-ready crontab entry in about 20 seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why I built this on a static site&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The whole site is GitHub Pages. No backend, no database, no server-side anything. The cron expression parser, the next-run-time calculator, all of it runs in the browser. That means it loads fast, works offline if you've cached it, and I don't have to pay for compute just so someone can build a cron expression.&lt;/p&gt;




&lt;h3&gt;
  
  
  Try it: &lt;strong&gt;&lt;a href="https://bashsnippets.xyz/tools/cron-job-builder.html" rel="noopener noreferrer"&gt;https://bashsnippets.xyz/tools/cron-job-builder.html&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Everything on BashSnippets is free. No login, no email capture, no limit on how many times you use it. Just open it, configure it, copy the output.
&lt;/h3&gt;

&lt;p&gt;If you've ever had a cronjob fail silently and had to debug it at an awkward hour, this is for you.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>devops</category>
      <category>automation</category>
    </item>
    <item>
      <title>CodeLegion? I think so. . .</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Wed, 06 May 2026 16:53:42 +0000</pubDate>
      <link>https://forem.com/bashsnippets/codelegion-i-think-so--998</link>
      <guid>https://forem.com/bashsnippets/codelegion-i-think-so--998</guid>
      <description>&lt;p&gt;🚀 Check out my CoderLegion profile &amp;amp; latest post!&lt;/p&gt;

&lt;p&gt;🏆 Points: 162 | 🎱 Badges: 5 | 👥 Followers: 0 | 📄 Posts: 3&lt;/p&gt;

&lt;p&gt;Latest post: "I built a free bash script library because I kept Googling the same 10 scripts over and over"&lt;br&gt;
Read it here: &lt;a href="https://coderlegion.com/16878/i-built-a-free-bash-script-library-because-i-kept-googling-the-same-10-scripts-over-and-over" rel="noopener noreferrer"&gt;https://coderlegion.com/16878/i-built-a-free-bash-script-library-because-i-kept-googling-the-same-10-scripts-over-and-over&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View my full profile: &lt;a href="https://coderlegion.com/user/BashSnippets" rel="noopener noreferrer"&gt;https://coderlegion.com/user/BashSnippets&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Come join me!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My site went down for a few hours yesterday and my users knew before me</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Mon, 04 May 2026 23:26:36 +0000</pubDate>
      <link>https://forem.com/bashsnippets/my-site-went-down-for-a-few-hours-yesterday-and-my-users-knew-before-me-1of6</link>
      <guid>https://forem.com/bashsnippets/my-site-went-down-for-a-few-hours-yesterday-and-my-users-knew-before-me-1of6</guid>
      <description>&lt;p&gt;It happened to me. &lt;/p&gt;

&lt;p&gt;My site — bashsnippets.xyz — had been down for six hours before I knew &lt;br&gt;
about it. I found out because a reader emailed me. Not because I checked. &lt;br&gt;
Not because I had monitoring. Because someone else had to tell me.&lt;/p&gt;

&lt;p&gt;That's the kind of thing that sits with you.&lt;/p&gt;

&lt;p&gt;The fix took 20 minutes to build. Here's exactly what I wrote and why &lt;br&gt;
every piece of it matters.&lt;/p&gt;


&lt;h2&gt;
  
  
  The problem with checking manually
&lt;/h2&gt;

&lt;p&gt;The natural instinct is to just open a browser and load the page. &lt;br&gt;
But that has two failure modes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You only check when you remember to&lt;/li&gt;
&lt;li&gt;You don't check at 2am when it actually goes down&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What you want is automated, logged, and running while you sleep.&lt;/p&gt;


&lt;h2&gt;
  
  
  Start with the one-liner
&lt;/h2&gt;

&lt;p&gt;Before building the full script, understand the core command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; /dev/null &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"%{http_code}"&lt;/span&gt; https://yoursite.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it. It prints one number. That number is your site's HTTP status code.&lt;/p&gt;

&lt;p&gt;Here's what each flag does — and this is worth understanding &lt;br&gt;
because you'll use these flags for a lot more than uptime checking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-o /dev/null&lt;/code&gt;&lt;/strong&gt; — tells curl to discard the response body entirely. &lt;br&gt;
You don't need the HTML. You only need the status code. &lt;br&gt;
Without this flag, curl dumps the entire page to your terminal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-s&lt;/code&gt;&lt;/strong&gt; — silent mode. Suppresses the progress bar and error messages. &lt;br&gt;
Without this, curl prints download stats you don't need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-w "%{http_code}"&lt;/code&gt;&lt;/strong&gt; — write-out format. Tells curl to print only &lt;br&gt;
the HTTP status code after the request completes. &lt;br&gt;
This is the only output you care about.&lt;/p&gt;

&lt;p&gt;Result: just the number. Nothing else. Clean, parseable, scriptable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; /dev/null &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"%{http_code}"&lt;/span&gt; https://bashsnippets.xyz
200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Status codes you need to know
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;What to do&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;Up and healthy&lt;/td&gt;
&lt;td&gt;Nothing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;301/302&lt;/td&gt;
&lt;td&gt;Redirect — usually fine&lt;/td&gt;
&lt;td&gt;Check it's intentional&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;404&lt;/td&gt;
&lt;td&gt;Page not found&lt;/td&gt;
&lt;td&gt;Check your URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;503&lt;/td&gt;
&lt;td&gt;Server error — site is down&lt;/td&gt;
&lt;td&gt;Investigate immediately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;000&lt;/td&gt;
&lt;td&gt;DNS failure / unreachable&lt;/td&gt;
&lt;td&gt;Your server may be completely offline&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  The full script
&lt;/h2&gt;

&lt;p&gt;Now wrap it in logic that tells you what the number means:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nv"&gt;CHECK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"✓"&lt;/span&gt;
&lt;span class="nv"&gt;CROSS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"✗"&lt;/span&gt;

&lt;span class="nv"&gt;URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://bashsnippets.xyz"&lt;/span&gt;
&lt;span class="nv"&gt;STATUS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; /dev/null &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"%{http_code}"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$STATUS&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-eq&lt;/span&gt; 200 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CHECK&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt; is up (HTTP &lt;/span&gt;&lt;span class="nv"&gt;$STATUS&lt;/span&gt;&lt;span class="s2"&gt;)"&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CROSS&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt; returned HTTP &lt;/span&gt;&lt;span class="nv"&gt;$STATUS&lt;/span&gt;&lt;span class="s2"&gt; — check it"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;$CHECK&lt;/code&gt; and &lt;code&gt;$CROSS&lt;/code&gt; variables aren't required — you could hardcode &lt;br&gt;
the symbols directly — but defining them at the top makes it trivial &lt;br&gt;
to change the output format later and keeps the echo lines readable &lt;br&gt;
at a glance.&lt;/p&gt;

&lt;p&gt;Save this as &lt;code&gt;uptime.sh&lt;/code&gt; in your home directory.&lt;/p&gt;


&lt;h2&gt;
  
  
  Make it executable
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ~/uptime.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;chmod +x&lt;/code&gt; adds execute permission to the file. Without this, &lt;br&gt;
bash treats it as a plain text file and refuses to run it.&lt;br&gt;
This is the step people forget. Every time.&lt;/p&gt;

&lt;p&gt;Test it manually before scheduling anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./uptime.sh
&lt;span class="c"&gt;# ✓ https://bashsnippets.xyz is up (HTTP 200)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Schedule it with cron
&lt;/h2&gt;

&lt;p&gt;A script you run manually is still manual monitoring. &lt;br&gt;
The goal is automation — the script checks your site while you sleep.&lt;/p&gt;

&lt;p&gt;Open your crontab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;*&lt;/span&gt;/5 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; ~/uptime.sh &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/uptime.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breaking this down:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;*/5 * * * *&lt;/code&gt;&lt;/strong&gt; — run every 5 minutes. The &lt;code&gt;*/5&lt;/code&gt; means "every 5th &lt;br&gt;
minute of every hour of every day." Change to &lt;code&gt;*/1&lt;/code&gt; to test it faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;~/uptime.sh&lt;/code&gt;&lt;/strong&gt; — the script to run. The &lt;code&gt;~/&lt;/code&gt; expands to your &lt;br&gt;
home directory — safer than a relative path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;&amp;gt;&amp;gt; ~/uptime.log&lt;/code&gt;&lt;/strong&gt; — append output to a log file. &lt;br&gt;
Using &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; instead of &lt;code&gt;&amp;gt;&lt;/code&gt; means each result adds to the file &lt;br&gt;
rather than overwriting it. You want a history, not just the last result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;2&amp;gt;&amp;amp;1&lt;/code&gt;&lt;/strong&gt; — redirect stderr to stdout so errors also get logged.&lt;/p&gt;

&lt;p&gt;Save and exit. Cron confirms: &lt;code&gt;crontab: installing new crontab&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Watch it run in real time
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/uptime.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;tail -f&lt;/code&gt; watches a file and prints new lines as they're added. &lt;br&gt;
Open this in a second terminal after setting up cron. &lt;br&gt;
Within a minute you'll see the script run on its own — &lt;br&gt;
no input from you, no trigger, just cron firing the script &lt;br&gt;
and the result appearing in the log automatically.&lt;/p&gt;

&lt;p&gt;That moment where the second line appears on its own — &lt;br&gt;
that's the confirmation that automation is actually working.&lt;/p&gt;


&lt;h2&gt;
  
  
  The full copy-paste version
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nv"&gt;CHECK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"✓"&lt;/span&gt;
&lt;span class="nv"&gt;CROSS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"✗"&lt;/span&gt;

&lt;span class="nv"&gt;URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://yoursite.com"&lt;/span&gt;   &lt;span class="c"&gt;# ← change this to your site&lt;/span&gt;
&lt;span class="nv"&gt;STATUS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; /dev/null &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"%{http_code}"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$STATUS&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-eq&lt;/span&gt; 200 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CHECK&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt; is up (HTTP &lt;/span&gt;&lt;span class="nv"&gt;$STATUS&lt;/span&gt;&lt;span class="s2"&gt;)"&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CROSS&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt; returned HTTP &lt;/span&gt;&lt;span class="nv"&gt;$STATUS&lt;/span&gt;&lt;span class="s2"&gt; — check it"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Cron line to add with &lt;code&gt;crontab -e&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;*&lt;/span&gt;/5 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; ~/uptime.sh &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/uptime.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full reference page with all variations:&lt;br&gt;
→ &lt;a href="https://bashsnippets.xyz/snippets/check-if-website-is-up.html" rel="noopener noreferrer"&gt;bashsnippets.xyz/snippets/check-if-website-is-up.html&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I post a new copy-paste bash script every week at &lt;a href="https://bashsnippets.xyz" rel="noopener noreferrer"&gt;bashsnippets.xyz&lt;/a&gt;.&lt;br&gt;
All free. No signups. &lt;a href="https://youtube.com/@BashSnippets" rel="noopener noreferrer"&gt;@BashSnippets on YouTube&lt;/a&gt; if you want to see these in 30-second form.&lt;/p&gt;

&lt;p&gt;How do you monitor your sites? I'm genuinely curious what the rest of you are running 👇&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>webdev</category>
      <category>sysadmin</category>
    </item>
    <item>
      <title>I was killing Ollama processes the hard way for months. A one-word command fixed it.</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Mon, 04 May 2026 18:07:14 +0000</pubDate>
      <link>https://forem.com/bashsnippets/i-was-killing-ollama-processes-the-hard-way-for-months-a-one-word-command-fixed-it-3f0i</link>
      <guid>https://forem.com/bashsnippets/i-was-killing-ollama-processes-the-hard-way-for-months-a-one-word-command-fixed-it-3f0i</guid>
      <description>&lt;p&gt;I run a lot of local LLMs. Ollama, OpenWebUI, coding models.&lt;br&gt;&lt;br&gt;
llama3, qwen-coder models, deepseek-coder, whatever I'm testing that week. &lt;/p&gt;

&lt;p&gt;The problem is Ollama doesn't always clean up after itself.&lt;/p&gt;

&lt;p&gt;Pull a few models. Run them. Close the terminal. Think you're done. &lt;br&gt;
You're not. There are now 3 or 4 &lt;code&gt;ollama&lt;/code&gt; and &lt;code&gt;ollama_llama_server&lt;/code&gt; &lt;br&gt;
processes still sitting in the background, each one holding &lt;br&gt;
6-8 GB of RAM hostage while I am trying to actually get stuff done.&lt;/p&gt;

&lt;p&gt;I'd notice it when my machine started lagging mid-session. &lt;br&gt;
Open a terminal, run &lt;code&gt;ps aux&lt;/code&gt;, and get back a wall of text &lt;br&gt;
200 lines deep. Scroll through it. Find the PID. Copy it. &lt;br&gt;
Run &lt;code&gt;kill&lt;/code&gt;. Realize there are two more and loop this way for an hour trying to clean everything up.&lt;/p&gt;

&lt;p&gt;Four commands. Every single time. For months:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash
ps aux | &lt;span class="nb"&gt;grep &lt;/span&gt;ollama   &lt;span class="c"&gt;# step 1: find it&lt;/span&gt;
&lt;span class="c"&gt;# scroll through output, locate PID&lt;/span&gt;
&lt;span class="c"&gt;# e.g. 47823&lt;/span&gt;
&lt;span class="nb"&gt;kill &lt;/span&gt;47823             &lt;span class="c"&gt;# step 2: kill it&lt;/span&gt;
&lt;span class="c"&gt;# still running? find the next one&lt;/span&gt;
&lt;span class="nb"&gt;kill &lt;/span&gt;47824             &lt;span class="c"&gt;# step 3: kill that one too&lt;/span&gt;
&lt;span class="c"&gt;# check again...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is my struggle for months. But then i learned &lt;code&gt;pkill&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  pkill exists and I ignored it
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;pkill&lt;/code&gt; lets you kill any process by name. No PID hunting. &lt;br&gt;
No &lt;code&gt;ps aux&lt;/code&gt; wall of text. One command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pkill ollama
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Every Ollama process, the server, the model runner, &lt;br&gt;
all of it. A fresh start, per se.&lt;/p&gt;

&lt;p&gt;But before you run that blindly, always do a &lt;code&gt;pgrep&lt;/code&gt; first. &lt;br&gt;
It shows you exactly what you're about to kill without &lt;br&gt;
actually killing anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pgrep &lt;span class="nt"&gt;-l&lt;/span&gt; ollama
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
47823 ollama&lt;br&gt;
47824 ollama_llama_server&lt;br&gt;
47825 ollama_llama_server&lt;/p&gt;

&lt;p&gt;Three processes. All Ollama. All eating RAM. Now you know &lt;br&gt;
what you're working with before you pull the trigger.&lt;/p&gt;

&lt;p&gt;Then kill them all in one shot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pkill ollama
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify they're gone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pgrep &lt;span class="nt"&gt;-l&lt;/span&gt; ollama
&lt;span class="c"&gt;# no output = all clear&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done. The whole workflow takes 3 seconds instead of 3 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The flags I actually use
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Preview before killing — always do this first&lt;/span&gt;
pgrep &lt;span class="nt"&gt;-l&lt;/span&gt; ollama

&lt;span class="c"&gt;# Kill all matching processes by name&lt;/span&gt;
pkill ollama

&lt;span class="c"&gt;# Exact match only — won't catch ollama_llama_server&lt;/span&gt;
pkill &lt;span class="nt"&gt;-x&lt;/span&gt; ollama

&lt;span class="c"&gt;# Force kill if it's frozen and won't respond&lt;/span&gt;
pkill &lt;span class="nt"&gt;-9&lt;/span&gt; ollama

&lt;span class="c"&gt;# Kill a specific model process by full command string&lt;/span&gt;
pkill &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s2"&gt;"ollama_llama_server"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-f&lt;/code&gt; flag is especially useful when you have multiple &lt;br&gt;
models running and only want to kill one of them. &lt;br&gt;
&lt;code&gt;pkill -f "codellama"&lt;/code&gt; will only hit the codellama process &lt;br&gt;
and leave everything else running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters more with local LLMs
&lt;/h2&gt;

&lt;p&gt;With normal processes you might have one or two orphans at a time. &lt;br&gt;
With Ollama you can easily have five or six. Tthe main server, &lt;br&gt;
plus a separate runner process for each model you've touched &lt;br&gt;
in a session. &lt;code&gt;kill&lt;/code&gt; with a PID was never designed for &lt;br&gt;
cleaning up that many processes at once, the runner processes were adding up.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pkill&lt;/code&gt; was.&lt;/p&gt;

&lt;p&gt;If you're running local LLMs regularly, this is the command &lt;br&gt;
that keeps your RAM clean between sessions. Add it to muscle &lt;br&gt;
memory alongside &lt;code&gt;ollama list&lt;/code&gt; and &lt;code&gt;ollama ps&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full pkill/pgrep reference with every flag:
&lt;/h2&gt;

&lt;p&gt;→ &lt;a href="https://bashsnippets.xyz/snippets/kill-a-process.html" rel="noopener noreferrer"&gt;bashsnippets.xyz/snippets/kill-a-process.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Free bash scripts for Linux and devs every week:&lt;br&gt;
→ &lt;a href="https://bashsnippets.xyz" rel="noopener noreferrer"&gt;bashsnippets.xyz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Also posted Short #5 on this yesterday if you want to see &lt;br&gt;
the before/after in 30 seconds:&lt;/em&gt;&lt;br&gt;
&lt;em&gt;&lt;a href="https://youtube.com/@BashSnippets" rel="noopener noreferrer"&gt;@BashSnippets on YouTube&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>bash</category>
      <category>linux</category>
    </item>
    <item>
      <title>I built a couple bash scripts this week after my server crashed Thursday at 11pm</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Sun, 03 May 2026 22:55:51 +0000</pubDate>
      <link>https://forem.com/bashsnippets/i-built-a-couple-bash-scripts-this-week-after-my-server-crashed-thursday-at-11pm-1j23</link>
      <guid>https://forem.com/bashsnippets/i-built-a-couple-bash-scripts-this-week-after-my-server-crashed-thursday-at-11pm-1j23</guid>
      <description>&lt;p&gt;&lt;strong&gt;My disk hit 100% on a Thursday night. Just a silent crash and a bunch of errors I found the next day.&lt;br&gt;
I had nothing running in the background watching for problems.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disk space warning**
The script I needed before that Thursday happened.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nv"&gt;THRESHOLD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;80
&lt;span class="nv"&gt;USAGE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;df&lt;/span&gt; / | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'NR==2{print $5}'&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'%'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USAGE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$THRESHOLD&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"⚠ Disk at &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;USAGE&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;% — time to act"&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"✓ Disk OK: &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;USAGE&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;% used"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I just happened to be doing some brushing up on &lt;code&gt;crontab&lt;/code&gt; a bit lately so I automated the script before I did anything else, so this wouldn't happen again. &lt;br&gt;
Full script with email alerts → &lt;a href="https://dev.tourl"&gt;bashsnippets.xyz/snippets/disk-space-warning.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Killing Processes&lt;/strong&gt;&lt;br&gt;
I also found myself continuing to fall into a &lt;code&gt;ps aux | grep ""&lt;/code&gt;&lt;br&gt;
loop after cleaning up the disk and new there was a one-word command out there that made it easier, but I couldn't recall...&lt;br&gt;
I had to google it a few times before it stuck with me:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pkill/pgrep&lt;/code&gt; &amp;lt;--- turned a 4 command work-flow into a one-word workflow:&lt;br&gt;
My loop was this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ps aux | grep myapp   #&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;find it
&lt;span class="gp"&gt;kill 12345            #&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;copy/paste PID
&lt;span class="gp"&gt;ps aux | grep myapp   #&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;confirm it died
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After, it was this: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;pgrep -l myapp&lt;/code&gt;&lt;br&gt;
&lt;code&gt;pkill -x myapp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where this went:&lt;/p&gt;

&lt;p&gt;So, of course, these and a few more, like error handling, turned into a free, and growing script library at &lt;a href="https://dev.tourl"&gt;bashsnippets.xyz&lt;/a&gt; — copy-paste ready, explained line by line, no signup.&lt;/p&gt;

&lt;p&gt;I also started turning each one into a short video on YouTube (&lt;a class="mentioned-user" href="https://dev.to/bashsnippets"&gt;@bashsnippets&lt;/a&gt;). Hoping to gain some traction in the beginner bash communities! &lt;/p&gt;

&lt;p&gt;Hope someone can find some use of this, but What are you automating? Drop it in the comments.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
    </item>
    <item>
      <title>I Got Tired of Googling the Same Bash Commands, So I Built This. . .</title>
      <dc:creator>Anguishe</dc:creator>
      <pubDate>Sat, 02 May 2026 21:02:27 +0000</pubDate>
      <link>https://forem.com/bashsnippets/i-got-tired-of-googling-the-same-bash-commands-so-i-built-this--186l</link>
      <guid>https://forem.com/bashsnippets/i-got-tired-of-googling-the-same-bash-commands-so-i-built-this--186l</guid>
      <description>&lt;p&gt;I kept running into the same problem while working in Linux and dev environments.&lt;/p&gt;

&lt;p&gt;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:&lt;/p&gt;

&lt;p&gt;Open Google&lt;br&gt;
Search “how to…”&lt;br&gt;
Find slightly different answers&lt;br&gt;
Test, break something, repeat...&lt;/p&gt;

&lt;p&gt;It wasn’t hard. . . it was just slow and monotonous.&lt;br&gt;
So, I began collecting the commands I actually used in real projects and organizing them into a personal cheat-sheet.&lt;/p&gt;

&lt;p&gt;Over time, it turned into a small curated collection of Bash snippets, Linux commands, and terminal tricks that I now use almost daily.&lt;/p&gt;

&lt;p&gt;Things like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;faster file searching&lt;/li&gt;
&lt;li&gt;process monitoring tricks&lt;/li&gt;
&lt;li&gt;Git shortcuts&lt;/li&gt;
&lt;li&gt;terminal productivity hacks&lt;/li&gt;
&lt;li&gt;small one-liners that replace entire workflows&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What I realized is that if something saves you 10 seconds but you use it 50 times a day, it adds up fast. I've been able to go from using 4-5 commands for the same bash one-liner that I just couldn't always recall.&lt;/p&gt;

&lt;p&gt;I decided to clean it up and turn it into something public instead of just a local note file.&lt;/p&gt;

&lt;p&gt;If you’re into Bash, Linux, or just want to speed up your terminal workflow, I’ve been putting everything here:&lt;br&gt;
&lt;a href="https://bashsnippets.xyz" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s still growing, and I’m actively adding new snippets as I find better ways of doing things. &lt;/p&gt;

&lt;p&gt;I realize this is super beginner level stuff but if you’ve got any underrated commands you think should be included, I’m always open to suggestions.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
