Send command to all window in tmux

vorand picture vorand · Feb 12, 2012 · Viewed 12.2k times · Source

Is a way to send the same command to all window in tmux, not to all pane in window. synchronize-panes - send command to all pane in one window. I need something like 'at' in screen.

Answer

Alex Gaudio picture Alex Gaudio · May 6, 2012

You could always do something like this:

session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message

You could also bind this to a key in your tmux.conf like this:

bind C-e command-prompt -p "session?,message?" "run-shell \"tmux list-windows -t %1 \| cut -d: -f1\|xargs -I\{\} tmux send-keys -t %1:\{\} %2\""