Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I recently switched from bash to zshell but my history does not seem to be working. When I press the up arrow I don't get the previous commands. Is the shortcut different?

Also how do I enable shared history through tabs and new windows? I am on Lion, and using the standard Terminal

share|improve this question

Up arrow should work, you can check what the shortcut is with this command:

bindkey | grep up-line

Depending on what your up-arrow sends to the terminal you might need to adjust it, use Ctrl-vUp to check. Use:

bindkey "KEYS" up-line-or-history


bindkey "KEYS" up-line-or-search

to fix it.

Shared history is enabled with:

setopt share_history

There may be some other options you want to set to avoid duplicates etc., see zshoptions(1).

Here's what I use:

setopt hist_expire_dups_first
setopt hist_find_no_dups
setopt hist_ignore_all_dups
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_no_store
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt hist_verify
setopt inc_append_history
setopt no_hist_allow_clobber
setopt no_hist_beep
setopt share_history

They've been added incrementally, so some of them might be redundant.

share|improve this answer
the 'setopt share_history' did not work.should I put the commands in the .zshrc file? – Test Sep 5 '12 at 14:26
Yes, and restart all open shells with the new configuration. – Thor Sep 5 '12 at 14:36

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.