Fork me on GitHub

Лупайте сю скалу...

Іван Франко

 RSS | Atom

19 June 2015


Selected projects See all »

Banalize: Bash static code analyzerDBIx::Report::ExcelShell settings, AKA dotfilesNagios Monitoring for Couchbase serverNagira: RESTful API for NagiosStartpack for Github pages developmentWeb iPhoto

Travel Blog Витрішки »

Україномовний блог Витрішки - блог про все, крім роботи. Цикл статей "Літо на півночі Японії" з цього блогу тепер опублікований у Витрішках

Computer Blog All posts »

iPhoto and files permission Is MacOSX 10.9 == MacOS 9.x? Running Chef roles from Capistrano und Capiche Github & Jekyll: Speeding up Jekyll siteGithub & Jekyll: More experience with Jekyll and setup changesBuild new hosts with Capistrano and Chef Request Tracker: More about custom CSS for RT4Ruby 2 test drive Nagira v0.2.5 release It's UNIX my dear Watson

Slides See all »

Nagira @TLUG, 2012Rspec and Guard


Ярило Yarylo, Jarilo me @ github me @ CPAN Dmytro (CV)

Start multiple synchronized SSH connections with Tmux


Small shell script to start multiple connections to SSH servers with synchronized keyboard.

If you need to connect to multiple SSH machines and perform some operation on all of them, there are many ways to do this. Typically regular sysadmin would write simple for one-liner in shell:

for i in $HOSTS; do <....> done

It's OK for simple command or couple of commands. But, if commands produce verbose output, or you want to see what's happening in between your commands, this approach can be more troublesome. Or, for example, your ssh keys are not set and you'd need to type password for each SSH prompt.

Tmux way

Using tmux you can do it in a different way. If you haven't started with tmux yet, there's a good reason to do it.

This script allows with single command open multiple equally split-panes in Tmux window and synchronizes keyboard input in all windows. Anything you type will go at the same time to all tmux panes and you will see output of commands in all windows as they are executed. Any time it is you can break keyboard sync between panes if you need to execute something in single shell only, then you can sync again and continue as before.

Full text of the script is provided in the Gist below. It is based on solution I've found online, a bit simplified and extended to accept list of hosts from command line.

I usually run it as:

ssh-multi myhost1 myhost2 myhost3 myhost4

or for some groups of hosts, I put list into plain text file:

ssh-multi $(cat list-of-hosts)

The script is included in dotfiles repository. You can eiterh copy-paste from included Gist, or simply get the whole thing, by cloning o downloading it using links below.

See also

Blog post regarding Tmux environment configuration

Script source code


Dmytro Kovalov (

Source code

дмитро ковальов
dmytro @ github