One Tip a Week: Slim Your Shell History

This week’s tip of the week is a all about streamlining your shell history. A while back I wrote about getting McFly working on Ubuntu Server. I got a comment about the post from Jonas Brømsø on DEV.

Jonas mentioned that Bash has a HISTIGNORE that you can leverage to slim your shell history, by not saving common commands following the patterns you specify

HISTIGNORE="pwd:ls:ls -l:cd:clear"

Apparently Zsh has a similar feature: HISTORY_IGNORE

export HISTORY_IGNORE="(ls|cd|pwd|exit|cd ..)"

This was super valuable to me immediately, so it is now part of my shell workflow. Check out Jonas’ post about slimming history.

That’s it! Short and sweet. Until the next one!