Environment & Shell Customization (Aliases/Functions/.Bashrc)
Stop fat-fingering your shell history with accidental clears
🧩 The Challenge
You know the feeling when you hit Ctrl+L to clear your terminal, but your pinky slips and hits something else, wiping your entire screen and making you lose sight of the important error message that just scrolled by. I’ve spent way too long staring at a blank buffer wondering what the hell the compiler just spat out.
💡 The Fix
Just disable the standard clear shortcut and replace it with a shell function that prints a bunch of newlines instead. You keep your history and your sanity.
clear() { printf '\n%.0s' {1..50}; }
⚙️ Why It Works
By shadowing the clear command with a shell function, the system executes your sequence of newlines instead of the actual binary. It pushes your previous work up into the scrollback buffer where it belongs, safe from being dumped.
🚀 Pro-Tip: Put this in your .bashrc and stop losing your place mid-debug.
Linux Tips & Tricks | © ngelinux.com | 8/29/2026
