Synchronize panes in tmux by toggling synchronize-panes with Ctrl+b :setw synchronize-panes on
to send the same commands to all panes in a window simultaneously. Turn it off with Ctrl+b :setw synchronize-panes off
.
Ctrl+b :setw synchronize-panes on
Synchronize-panes is a powerful tmux feature that allows you to send the same keyboard input to multiple panes simultaneously. This is incredibly useful when you need to run identical commands across multiple servers, environments, or directories.
To turn on synchronize-panes:
setw synchronize-panes on
and press EnterTo turn off synchronize-panes:
setw synchronize-panes off
and press Enter It's helpful to have a visual indicator when synchronize-panes is active. Add this to your ~/.tmux.conf
to change the status line color when synchronize-panes is on:
set-option -ag status-right '#{?pane_synchronized, #[bg=red]SYNC#[default],}'
To toggle synchronize-panes with a single key combination, add this line to your ~/.tmux.conf
:
bind e set-window-option synchronize-panes
With this binding, you can toggle synchronize-panes by pressing Ctrl+b followed by e.
When using synchronize-panes with multiple servers, consider setting a different prompt color in each pane before enabling synchronization. This helps you visually distinguish between different environments while typing the same commands.
Synchronize-panes is especially useful for: