Quit accidentally nuking your production database with rm
Environment & Shell Customization (Aliases/Functions/.Bashrc)
Quit accidentally nuking your production database with rm
🧩 The Challenge
Everyone has had that heart-stopping moment where they realize they just hit enter on a recursive delete in the wrong directory. I once wiped a staging site because my tab-completion lied to me and I didn’t look closely enough.
💡 The Fix
Start forcing interactive mode by default so the shell actually makes you confirm before it destroys everything. It feels annoying for five minutes until you save your own skin during a late-night maintenance window.
alias rm='rm -i'
⚙️ Why It Works
Setting this alias overrides the standard behavior of the binary by passing the interactive flag automatically. You’ll still be able to use the command normally, but the shell will stop and verify each deletion request before hitting the disk.
🚀 Pro-Tip: Use \rm if you genuinely need to skip the prompt for a massive bulk cleanup job.
Linux Tips & Tricks | © ngelinux.com | 12/2/2026
