Environment & Shell Customization (Aliases/Functions/.Bashrc)
Stop letting your shell history become a messy junk drawer
🧩 The Challenge
Trying to find that one specific complex sed command you ran three weeks ago is a nightmare when your history file is clogged with hundreds of accidental ls and cd calls. You end up scrolling through a massive wall of noise instead of actually working.
💡 The Fix
Use a shell variable to ignore those repetitive, low-value commands automatically. It cleans up your scroll-back buffer so only the commands that actually matter remain visible.
HISTCONTROL=ignoreboth:erasedups
HISTIGNORE="ls:ls *:cd:cd ..:pwd:exit:clear"
⚙️ Why It Works
Setting ignoreboth keeps commands that start with a space out of your history, and erasedups kicks out older duplicates the moment a new one is typed. By explicitly listing those one-off navigation commands in HISTIGNORE, you keep the signal-to-noise ratio in your bash history actually readable.
🚀 Pro-Tip: Stick this in your .bashrc and run source ~/.bashrc, but remember that erasedups only works for future commands.
Linux Tips & Tricks | © ngelinux.com | 7/19/2026
