With Tip 1, we looked at how we can switch our history between local directory and global.
Regardless of which you're using, some stuff just doesn't belong there; right?
Do you really use to Control + r or Up to find ls
, cd
, or rm
?
No. The answer is no.
Keeping History Clean
Here are 3 short and sweet options you can configure in your zshrc
file to keep your history lean, mean, and clean.
Forget Duplicate Commands
Zsh can de-duplicate your command history đ
Enable this behaviour with setopt HIST_IGNORE_DUPS
Forget Common Commands
The next approach to keeping our history clean is using HISTIGNORE
.
HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd:cd ..:cd..:zh"
This is a global list of commands and patterns that you don't want to keep.
Use this for all your trivial commands that don't warrant searching later.
Forget Space Commands
Another great feature of Zsh is hiding commands preceding with a Space
Enable this behaviour with setopt HIST_IGNORE_SPACE
# Not stored in history
ls
# Stored in history
ls
You can find more examples of tweaking your history here
Top comments (0)