Environment & Shell Customization (Aliases/Functions/.Bashrc)
Stop your shell from letting you sudo away your life without thinking
🧩 The Challenge
You have definitely run a destructive command like rm -rf on the wrong directory because you were already logged in as root or had sudo cached. It takes exactly one mistake to ruin your week.
💡 The Fix
Change your shell prompt to turn bright red when you are root so you get a physical reaction when your cursor changes color. It saves you from that sinking feeling of hitting enter too soon.
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
⚙️ Why It Works
Setting the escape sequence to 01;31m forces the bash prompt to render in bold red for the current user and host part. Using this makes sure you never accidentally type a production-killing command while you think you are just a standard user.
🚀 Pro-Tip: Add a different color for your development vs production servers so you know where you are before you even type.
Linux Tips & Tricks | © ngelinux.com | 8/21/2026
