DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Run Interactive Shell on Multiple Hosts


I want edit the file .bash_profile on multiple hosts. I could edit one of them then scp to others. But I can edit them simultaneously with some fancy tools.

This can be done easily with the Grouping and Broadcast function of Terminator.

In the terminator window, create a New group (in context menu > Grouping), then split the terminal window and assign these new windows to the group you just created. The current working window has a red title bar. Other windows in the same group have blue title bars. The windows outside the group has no title bars.

Now when in mode Broadcast group (keyboard shortcut Alt-g), every key press will be sent to every terminal in this group, including key combinations such as Ctrl-Shift-v (paste texts) and Ctrl-d.

If you want do something different in each window, switch the mode to Broadcast off with keyboard shortcut Alt-o. After it's done, switch back to broadcast mode with Alt-g.

After all things are done, you can remove the group.

There are some other tools, such as tmux, clusterssh, mussh, but I didn't try them. See How do I run the same linux command in more than one tab/shell simultaneously? for details.



Published

Dec 29, 2018

Last Updated

Dec 29, 2018

Category

Tech

Tags

  • multiple hosts 1
  • shell 46

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor