Splitting a tmux session window into multiple panes can do wonders for productivity. Here you’ll see how easy synchronizing tmux panes is.
But, what if you would like to use this feature to automate a workflow across many machines?
You’ll be glad to know it is possible to synchronize panes in a tmux window.
This allows you to execute a series of commands or particular workflow across many machines.
First of all, if you haven’t already, split your window into the panes you need. The commands for this of course (assuming CTRL + B is prefix for tmux commands) are:
Split vertical: CTRL + B, %Split horizontal: CTRL + B, “
You may wish at this point to connect each pane to the relevant machine you want in each.
Synchronize the panes by entering tmux command mode with:
CTRL + B, :
setw synchronize-panes on
Hit enter and you’ll immediately notice all the panes are now synchronized. At this point you can go wild and execute whichever workflow you want to automate across the subjects.
You can toggle the synchronization off again by entering command mode once more and typing:
:setw synchronize-panes off
You can also use the same command to toggle synchronization on/off by omitting the on/off parameter on the end. Synchronizing tmux Panes is toggled when omitting this parameter.