How to send a command to all panes in tmux?
A bit late to the party but I didn't want to set and unset synchronize-panes just to send one command so I created a wrapper function around tmux and added a custom function called send-keys-all-panes
.
_tmux_send_keys_all_panes_ () {
for _pane in $(tmux list-panes -F '#P'); do
tmux send-keys -t ${_pane} "$@"
done
}
I also create a wrapper around the tmux command to simplify calling this function (for convenience). The wrapper and the above code are all here.
This allows me to run tmux send-keys-all-panes <command>
or tmux skap <command
to send <command>
to all panes.
Note that tmux is aliased to my wrapper function tmux_pp.
Have you tried following in tmux window with multiple panes
Ctrl-B :
setw synchronize-panes on
clear history