Skip to main content
3 of 5
clarify what I mean by including other shell answers
xenoterracide
  • 61.5k
  • 79
  • 196
  • 252

is there any way to keep a command from being added to your history?

is there any way to keep a command from being added to your history? I have a command that I want to keep out of my history file, and I really don't care to have it there when I search the history stored in memory, though that's less of a concern. Is there any way to prevent this? or do I just have to go back and edit my history file.

update: I didn't realize this might be shell specific. my shell is zsh how would I do it in zsh? (though you're welcome to answer for other shell's, including bash, so people know how to do this in their shell, but those answers won't help me specifically)

xenoterracide
  • 61.5k
  • 79
  • 196
  • 252