Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 12 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.

share|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
    
This wasn't working for me, until I read the whole text and realized it's awesomer than bash!! –  user18151 Aug 19 at 9:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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