Run commands simultaneously on different servers

After searching and browsing the internet, I stumbled on the tmux-xpanes project, a “plugin/wrapper” for tmux. xpanes makes is trivial and easy to configure multiple Tmux panes at once and uses the “synchronize-panes” feature so that the inputs are “synchronized” across all the panes.

In my particular case, I use the --ssh options to open SSH sessions into multiple load generating machines, at which point it’s like working with a single instance, but you still receive feedback from all the devices asynchronously. As you can see in the GIF, the input is synchronous, but you receive asynchronous feedback from the command’s output.

Besides using it for ssh’ing into several machines simultaneously, you can also apply it for other use cases where you want to run commands in parallel at once. Check out the TL;DR section, which contains some useful examples.

Naturally, you don’t want to use this approach for administrating multiple machines. Using xpanes is more for Adhoc things. Tools like Ansible or Puppet are better suited to deal which such problems.