Is there an SSH client which duplicates commands to multiple terminals?

Solution 1:

Cluster SSH

Cluster SSH is used to start multiple SSH connections in separate terminal windows, with a common input box. You type in the input box and the keystrokes are sent to all the connected terminals.

sudo apt-get install clusterssh

Then run cssh:

cssh host1 host2 ...

Use a terminal emulator with broadcasting

Terminator, for example, is a terminal emulator in which you can broadcast keystrokes to a group of terminals.:

enter image description hereenter image description here


Depending on how many connections you make, Cluster SSH might be the better option. However, it uses xterm for the terminal emulator, which may not be what you are used to. It is, however, much more easy to get started with a number of connections using cssh, than to create a lot of splits and group them in Terminator. For example, this is what cssh osl-{01..95} gets me:

enter image description here

The terminal windows were are all resized and tiled nicely. The gaps are for windows that were closed because the connection failed.

Solution 2:

There are many options to achieve what you want. My favorite is pssh (Parallel SSH). It can run commands parallely on multiple hosts and have variety of options.

You can install it by:

sudo apt-get install pssh

pssh has some added advantages like it will be installed with parallel-scp, parallel-rsync binaries to do as their names suggest.

Here is an example to run whoami command as user foobar on two hosts using pssh:

parallel-ssh -iAH "host_1 host_2" -l foobar "whoami"

Check man pssh or here to get more idea.