I am using iTerm2 (with zsh), and for some reason the history is shared between the different tabs and windows that are open. In most of the cases for me, this is annoying, since I have tabs per specific task, and if I have to redo some commands, I just want to be able to go back (up) in history to retrieve the last action for that window/tab only.

I have no idea how to disable this shared history, I read somewhere that you can enable shared history in zsh, but afaik I have done no such thing.

Can anybody point me in the right direction?

1 Answer 1


Executing the following should do the trick (use setopt to reenable them):

unsetopt inc_append_history
unsetopt share_history
  • 3
    Do I add these to my .zshrc?
    – nathanvda
    Dec 21, 2012 at 11:04
  • 1
    and with bash???
    – nkint
    Jan 22, 2013 at 21:31
  • 3
    @nathanvda yep, you add this to .zshrc. Jan 27, 2015 at 3:00
  • 1
    What about bash shell?
    – A.D
    Jul 14, 2016 at 16:03
  • 4
    I am getting -bash: unsetopt: command not found. Is it possible that this is something tmux related? Afaik I am not using tmux, but I am still experiencing the same problem as OP Oct 18, 2016 at 16:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .