Controlling Command Line History
From Zanecorpwiki
The key is the environment variable HISTIGNORE. Set this variable to a list of ':' separated glob patterns. The first token of each command is compared against the pattern and anything matching is excluded from history. For example:
HISTIGNORE=' *' # ignores any command starting with a space HISTIGNORE='secretexecutable' # ignores the secret executable HISTIGNORE='ls:cd' # ignores ls and and cd HISTIGNORE='??' # ignores all two letter commands HISTIGNORE=' *:??' # ignores all commands starting with a space and all two letter commandss
For my line of work, I find the HISTIGNORE=' *' makes the most sense. For the home user, the two letter stuff might make sense too. There's a lot of benefit to a clean history, but for me something like cd foo/bar; start service; cd ../baz; test service; cd ..; is a fairly common string, and clearly there's value in remembering something like that.


