A great solution for this problem is an excellent tool called multixterm, which enables you to simultaneously open xterms to any number of systems, type your commands in a single central window and have the commands executed in each of the xterm windows you've started. Sound appealing? Type once, execute many -- it sounds like a new pipelining instruction set.
multixterm requires expect and tk. The most common way to run multixterm is with a command like
multixterm -xc "ssh %n"host1 host2.
|Click to enlarge|
This command will open ssh connections to host1 and host2. Anything typed in the area labeled "stdin window" (which is usually gray or green, depending on your color scheme) will be sent to both windows, as shown in the figure.
As you can see from the sample command, the
-xc option stands for execute command, and it must be followed by the command that you want to execute on each host, enclosed in double quotation marks. If the specified command includes a wildcard such as
%n, each hostname that follows the command will be substituted into the command in turn when it is executed. Thus, in our example, the commands
ssh host1 and
ssh host2 were both executed by multixterm, each within its own xterm window.