Sync tmux panes

If you have a Tmux window divided into panes, you can use the synchronize-panes window option to send each pane the same keyboard input simultaneously:

Synchronize panes demo

You can do this by switching to the appropriate window, typing your Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up a Tmux command line, and typing:

:setw synchronize-panes

You can optionally add on or off to specify which state you want; otherwise the option is simply toggled. This option is specific to one window, so it won’t change the way your other sessions or windows operate. When you’re done, toggle it off again by repeating the command.

This is an easy way to run interactive commands on multiple machines, perhaps to compare their speed or output, or if they have a similar setup a quick and dirty way to perform the same administrative tasks in parallel. It’s generally better practice to use Capistrano or Puppet for the latter.

4 thoughts on “Sync tmux panes

  1. Pingback: Quickies: sync panes in tmux « 0ddn1x: tricks with *nix

  2. Excellent feature. Unfortunately the chances of a circumstance arising in which I could really benefit from it coinciding with me remembering that it’s possible tends towards zero :-(

  3. These two in your .tmux.conf will allow keybindings so you can type (PREFIX=Cntrl-A or W):

    PREFIX n # (on) PREFIX f # (off)

    Just a quick key I thought was helpful. Your page helped me get this. Thanks for the help!

  4. bind e setw synchronize-panes on bind E setw synchronize-panes off

    These two in your .tmux.conf will allow keybindings so you can type (PREFIX=Cntrl-A or W):

    PREFIX n # (on)

    PREFIX f # (off)

    Just a quick key I thought was helpful. Your page helped me get this. Thanks for the help!

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use Markdown if you want.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>