Can you share wisdom on using HISTIGNORE in bash?

I was reading the manpages for bash on the plane and I stumbled across the HISTIGNORE variable. To test it out, I immediately edited my .profile to define this variable:

export HISTIGNORE=ls

I tested it out and this is great! It excludes plain 'ls' commands from my history without excluding more interesting commands with lengthy paths, but having recently harvested a great deal of wisdom from SU I am eager to know what other commands superusers might recommend or other lessons learned.

What can you share about using the HISTIGNORE variable in bash?


I ignore ls without commands, bg, fg, exit, pwd, clear, mount and umount:

If you include this in your HISTIGNORE string you can suppress anything as you wish by adding a space at the front of the command:

"[ \t]*" 

This is my HISTIGNORE:

HISTIGNORE="&:ls:[bf]g:exit:pwd:clear:mount:umount:[ \t]*"

I've excluded some other stuff that I have in there that are repetitive commands that are unique to my server. Anything you do that is simple is a good thing to exclude.

I have other stuff which I have forgotten to add but I'm miles away from my Linux box so I am going off of memory.


Don't save trivial one and two character commands on the history list:

HISTIGNORE='?:??'

If the extglob option is enabled, you can also use extended patterns, e.g.

HISTIGNORE='a*( )'