Sharing history in zsh

One feature of any shell that is immensly useful is the history. Any command you made gets recorded, and you can then retrieve it later on with various commands (my favorite: Ctrl-R, which allows you to search through your history).

At any given time, I usually have anywhere between 10 and 20 terminals open somewhere (not counting remote sessions). Thanks to zsh I can share every command I enter between all those terminal after I enter it and make it accessible via the history.

This means I no longer have to remember which terminal I entered my command in, all I have to do is search the history.

How to enable this

In your .zshrc:

# Appends every command to the history file once it is executed
setopt inc_append_history
# Reloads the history whenever you use it
setopt share_history