When you’re working with tmux, the ability to type a command once and have it execute in multiple panes simultaneously is a game-changer, especially when you’re managing several servers or running repetitive tasks. This feature, called synchronized panes, lets you broadcast your input to all active panes in a window.

Let’s see it in action. Imagine you have a tmux window split into three panes, each connected to a different server. You want to check the disk space on all of them.

First, start tmux and set up your panes. You might do this by opening a new window and then splitting it:

tmux new-window
tmux split-window -v  # Split vertically
tmux select-pane -t 0 # Select the top pane
tmux split-window -h  # Split the bottom pane horizontally
tmux select-pane -t 0 # Go back to top pane
tmux select-pane -t 1 # Select bottom-left pane
tmux select-pane -t 2 # Select bottom-right pane

Now, you have three panes. Let’s say pane 0 is your SSH session to server1, pane 1 to server2, and pane 2 to server3.

To enable synchronized panes for the current window, you’d enter tmux command mode (usually Ctrl+b then :) and type:

setw synchronize-panes on

After pressing Enter, any typing you do in any of these three panes will be mirrored in the others. So, if you type df -h in pane 0, you’ll see df -h appear and execute in panes 1 and 2 as well.

This is incredibly useful for tasks like:

  • Running the same command across multiple remote servers (e.g., apt update, git pull).
  • Starting or stopping services simultaneously.
  • Tailoring configuration files on several machines at once.

The underlying mechanism is straightforward: tmux acts as a central dispatcher. When synchronize-panes is on, tmux intercepts every keystroke you make in the active pane and multicasts it to all other panes within that same window. It’s not magic; it’s just clever input routing.

To disable synchronization, you simply repeat the command:

setw synchronize-panes off

You can also bind this command to a key for quick toggling. For example, to toggle synchronization with Ctrl+b followed by s:

bind s setw synchronize-panes \; display-message "Synchronize panes #{pane_synchronized}"

This command defines a new key binding. When you press Ctrl+b then s, tmux will toggle the synchronize-panes setting for the current window and then display a message indicating whether synchronization is now on or off.

One detail that often trips people up is that synchronization is window-specific. Turning it on in one tmux window doesn’t affect any other windows you have open. If you want synchronization across all your windows, you’ll need to enable it in each one individually. This per-window setting is intentional; it prevents accidental synchronization when you don’t intend it.

The most surprising aspect for many is that tmux doesn’t just mirror keystrokes; it also mirrors deleted characters and cursor movement. If you backspace, tmux sends the backspace character to all panes. If you use arrow keys to move around in a command line, those movements are also broadcast, which can be disorienting if you’re not expecting it. This means that while you’re typing, the cursor in the other panes is also moving, showing you exactly where tmux is inserting your keystrokes.

Once you’ve mastered synchronized panes, the next logical step is exploring how to manage multiple tmux sessions and windows more dynamically, perhaps using scripts to provision and manage your tmux layouts automatically.

Want structured learning?

Take the full Tmux course →