Hack 64. Ignore specific commands from the history using HISTIGNORE

Sometimes you may not want to clutter your history with basic commands such as pwd and ls. Use HISTIGNORE to specify all the commands that you want to ignore from the history.
Please note that adding ls to the HISTIGNORE ignores only ls and not ls -l. So, you have to provide the exact command that you would like to ignore from the history.

# export HISTIGNORE=”pwd:ls:ls –ltr:”

# pwd

# ls

# ls -ltr

# service httpd stop

# history | tail -3
       79  export HISTIGNORE=”pwd:ls:ls -ltr:”
       80  service httpd stop
       81  history

[Note: History did not display pwd and ls]

Comments on this entry are closed.