Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share history between panes/windows

Tags:

zsh

tmux

Is there a way to share the shell command history between panes/windows in a tmux session?

like image 972
Devon Ville Avatar asked Sep 03 '12 12:09

Devon Ville


2 Answers

Add these options to your .zshrc:

setopt inc_append_history

I also find hist_ignore_dups hist_ignore_space useful.

See also Zsh » Options » History.

like image 68
Zaz Avatar answered Nov 12 '22 09:11

Zaz


shell history has precious little to do with tmux, it has to do with the shell you are using. So if you chose to use zsh it is enabled iirc by default. With bash you need to add some magic to your .bashrc

export PROMPT_COMMAND="history -a; history -n"

this appends your last command to history and reloads your history after each command. See this post for more information.

like image 36
three Avatar answered Nov 12 '22 10:11

three