Home > command line > How to execute a command in multiple Terminals by executing a command in only one?

How to execute a command in multiple Terminals by executing a command in only one?

December 1Hits:1
Advertisement

This question already has an answer here:

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

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.

Answers

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:

How to execute a command in multiple Terminals by executing a command in only one?

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!

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).

Related Articles

  • How to execute a command in multiple Terminals by executing a command in only one?

    How to execute a command in multiple Terminals by executing a command in only one? December 1

    This question already has an answer here: Is there an SSH client which duplicates commands to multiple terminals? 2 answers 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,

  • Utility to send a command to multiple terminals?September 15

    A while ago when I did a lot more system admining, there was a little utility that would send a command to multiple terminals that I had open. So essentially I could ssh into three different servers, then type tail -f /var/log/some_error.log into the

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

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

    I'd like to control several ssh connections from one terminal. For example, I would type ifconfig in the main terminal and all the other ssh connections would run ifconfig. That's what offered PuttyCM on Windows . This may be a very simple question b

  • Execute a command on multiple hosts, but only print command if it is successful?April 11

    Here's what I want to do. I want to check over 100 hosts and see if a file exists on that host. If the file does exist, then I want to print the hostname and the output of the command. In this example example, assume that I have three hosts: host1.ex

  • is there any command like "wall" that runs a "command" in all terminalsJuly 5

    as you know "wall" command sends a message to all terminals: wall message now my question is this: is there any command that can send a "command" to be run in all terminals? for example sending clear command to all terminals , so then

  • Script for Opening Two Terminals and Execute Three Consecutive Commands

    Script for Opening Two Terminals and Execute Three Consecutive Commands June 27

    I'd like to write a script for opening multiple programs (servers) simultanously in separate terminals - doesn't matter which one - and assign different commands to different terminals with commands "landing" inside the correct terminal. Is this

  • not able to execute multiple commands on multiple linux machines?September 2

    I have around 50 ubuntu machines on which I need to run below commands: sudo apt-get install htop sudo scp -r [email protected]:/home/todd/pip /tmp/ sudo apt-get install python-pip sudo pip install --no-index --find-links="file:///tmp/pip/"

  • How to write Bash script What is the command to open a terminal with two different tabed terminals and execute some commands separately tabs?October 20

    How to write Bash script to open a terminal with two tabs, and execute commands in both tabs? for instance: tab 1 opens skype tab 2 opens chromium-browser In the end, I want one more thing: write a bash script with my skype username and password and

  • How to send one command to multiple PC's over LAN (linux)January 27

    O/S: Debian Hi, I've got multiple computers in a LAN network that I monitor remotely, they're all running the same hardware and software. To monitor them I simply ssh in to one computer and then ssh off that on to the others. I was wondering if it wa

  • On a linux server how do you use multiple terminals over a single ssh connection?May 1

    I often find myself opening several ssh connections in order to view several log files at a time with tail -f. This isn't a problem when I'm at home because I use public key encryption for password-less login. However, I will often use computer at my

  • How to create multiple "terminals" for a linux workstation?November 3

    I wanted to figure out how to have multiple terminals (monitor, keyboard, and mouse) use a single centralized system. I guess at this point I can get computers for around $150, and use them as dumb terminals, but I would really like to centralize abo

  • Same command on multiple serversMay 20

    I'm just wondering if there is any fellow sysadmin with the need to execute one command on multiple servers. If so, what technique are you using? I have grown tired to ssh-ing to 3-5 servers and executing the same thing over and over again, so I'm th

  • Automatically opening multiple terminal windows with different commandsJuly 29

    For a certain task, everytime I have to open 10 bash terminals and write different commands on them. Any way to automate this ? I am running Fedora linux. --------------Solutions------------- Just create a shell script which spawns those terminals an

  • Running command on multiple serversMay 9

    I would like to run a basic command on multiple servers by using a response file, similar to your How to ping multiple servers and return their IPs command. I can run the command from my workstation and it returns all of the information just fine. sc

  • How do I open multiple terminals?

    How do I open multiple terminals?May 15

    I just downloaded Ubuntu 11.04 and as far as I can remember, there was the option of opening multiple terminals in tabs in Ubuntu. I cannot discover this feature in 11.04. Also, as a general query, suppose I open emacs from the terminal, then I would

  • Why does the PING command in my batch file execute in a loop?

    Why does the PING command in my batch file execute in a loop?June 18

    I created a .BAT file in Windows 7 that has the following line: PING XXX.XXX.XXX.XXX -t (XXX replaces the actual IP number). However, when I double click on this batch file, I can see the PING command repeatedly being executed in a loop. I even tried

  • What is the unix command to find out what executable file corresponds to a given command?October 29

    For example, if passed ls as input it should tell me that /bin/ls will run if run ls on the command-line. --------------Solutions------------- The command to use varies from shell to shell. Only a shell built-in will tell one correctly what the shell

  • How to run multiple terminals on remote ubuntu server through ultravnc?July 29

    I am trying to simultaneously run multiple instances of my application from terminal on remote ubuntu server. Single terminal is required for running a single instance of application. I am accessing remote server through putty and ultravnc viewer. Ev

  • Why there are multiple folders for executable files in Linux? June 18

    This question already has an answer here: /usr/bin vs /usr/local/bin on Linux 4 answers I'm trying to understand Linux file system, and one of the question is: 1- Why there are multiple folders for executable files: /usr/bin, /usr/sbin/ and /usr/loca

  • APC Smart-UPS 1000VA - command file won't get executed

    APC Smart-UPS 1000VA - command file won't get executedAugust 13

    I've got this old piece - http://goo.gl/5M37Sc, working reliably so far, but it has one big problem: command file when power is down won't run. Everything seems to be configured correctly, but when power is down, no email notification is sent nor my

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.969 s.