Skip to content
Jan 18 / Derek Reeve

Shared command history with zsh

In addition to intelligent word boundaries, another neat feature I came across with zsh was shared command history. This can be useful if, for example, you use GNU Screen and often open new shells but don’t want to lose your previous command history.

This is as simple as adding

setopt share_history
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.history
setopt APPEND_HISTORY

to your ~/.zshrc. Running a new shell should automatically start with the history from the shell you were previously using!

Update: Wordpress crammed some of the options together, so I fixed it.