3

This question already has an answer here:

I am going to have multiple machines that I am going to connect to via SSH so I am going to have multiple Terminal windows up, though what I want to do is to execute a command so that all the machines execute it, but currently what I will have to do is execute it in each individual Terminal window, is there any way that I can execute a command in one Terminal which will execute a specified command in all specified Terminal sessions for greater efficiency as I don't want to have to enter it into every individual Terminal window? I am going to be using gnome-terminal if that makes any difference.

I am running Ubuntu GNOME 15.10 with GNOME 3.18 and the other machines should be running the same.

marked as duplicate by muru, Eric Carvalho, Charles Green, waltinator, hg8 Dec 4 '15 at 9:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Not sure if this is what you are looking for, but it can be used like that: askubuntu.com/a/642095/72216 – Jacob Vlijm Dec 1 '15 at 21:43
  • If you are using keys, and your keys are loaded, in a separate terminal, script it. for ssh in list ; ssh user@$ssh "command"; done – Panther Dec 1 '15 at 21:44
  • 1
    @JacobVlijm: Yeah, well if I could tell it in one command to send the command to multiple Terminal windows then that would do. – user364819 Dec 1 '15 at 21:52
  • Should be possible! – Jacob Vlijm Dec 1 '15 at 21:53
4

One that I have used is ClusterSSH to send to multiple terminal windows at once.

sudo apt-get install clusterssh

ClusterSSH will open its own terminal windows that you can send commands to with the application. Once in ClusterSSH press Ctrl+Shift++ or click on Hosts in the menu and select Add host(s) or cluster(s) and type in all you want open separated by space between each one. You should get a window looking like this one:

enter image description here

then any command that you want to send to all the windows at once you type in the box below the File Hosts Send Help menu items.

Hope this helps!

1

Take a look at the terminator terminal emulator. Homepage with screenshots: http://gnometerminator.blogspot.hu/p/introduction.html

It can open multiple panes (right click menu -> Split Horizontally/Vertically, or its corresponding Ctrl+Shift+O/E shortcuts).

Then click on the upper left button of a pane to organize these panes into groups, and broadcast keypresses to members of a group (or all the terminals). (These also have shortcuts, as you can see or alter them in the right click -> Preferences menu.)

There's an Ubuntu package available, but if you really like this app and plan to use it in the long run, I recommend to check out the gtk3 version from https://code.launchpad.net/~gnome-terminator/terminator/gtk3. Ubuntu ships the gtk2 version, but the gtk3 version is way more improved (mostly due to plenty of fixes to the underlying VTE library's gtk3 version which is responsible for the actual terminal emulation, but also due to quite a few recent fixes to Terminator itself).