In Bash I know putting a space before a command prevents it from being kept in the history, what is the equivalent for the zshell?

link|improve this question

80% accept rate
feedback

1 Answer

up vote 1 down vote accepted

Use the HIST_IGNORE_SPACE option.

setopt HIST_IGNORE_SPACE

man zshoptions

HIST_IGNORE_SPACE

Remove command lines from the history list when the first character on the line is a space, or when one of the expanded aliases contains a leading space. Note that the command lingers in the internal history until the next command is entered before it vanishes, allowing you to briefly reuse or edit the line. If you want to make it vanish right away without entering another command, type a space and press return.

link|improve this answer
great answer! thanks – bneil Nov 1 '11 at 20:02
I wish I could do this for all-the-commands-typed-in-a-terminal-window-since-open on OSX. For when you realize that you've been barking up the wrong tree. – Yar Nov 1 '11 at 22:57
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.