Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently I have zsh set up in such a way that command history is shared between all sessions immediately.

Say I have a terminal emulator open with two tabs, each with a zsh session, A1 and A2. If I enter ls -la in A1, and then go to A2 and press up arrow key, I will see ls -la in the command prompt.

I would like to change it so sessions don't share the command history with each other although when you start new session it gets all the previous history from all sessions before it.

share|improve this question
up vote 9 down vote accepted

Check out the available options to control history. I think you want

setopt append_history no_inc_append_history no_share_history

This is the default zsh setup, by the way.

You can save the history explicitly at any point with fc -AI and merge it back in with fc -RI.

share|improve this answer

Your Answer


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.