I would like to launch multiple terminals also ssh to certain machines automatically in linux. Below is my problem I want to solve. I would want to run a script, which has the list of machines {Say m1,m2,....m10} which I want to ssh. So when i run the script/launcher, it should open terminals in same window(using terminator), ssh to above machines and if I had mentioned the password, even login to those machines. How can I achieve this, as I need to ssh to tens of machines daily, from terminator, but I am too lazy to type in each of the machine IP and ssh to them. Also, I would like to have the benefit of maintaining many such launchers/scripts, as they may be of different clusters. Eg: One launcher should open 6 terminals and ssh to m1,m2,m3,m4,m5 which are part of same logical session(say cluster) another launcher should open 4 terminals in same session and ssh to x1,x2,x3,etc

  • 2
    To let us help you stay lazy, you need to show us the results of your hard work. What have you tried so far and where are you stuck? Please edit the question and show research effort, the actual (imperfect) script etc. – Kamil Maciorowski Sep 9 at 7:25
  • Would tmux also be acceptable? If yes, have a look at an extension called xpanes. – dirkt Sep 9 at 9:45

pexpect can be an elegant tool to achieve the automation you seem to be looking for https://pexpect.readthedocs.io/en/stable/


You can run a given command by passing it to the gnome-terminal (or related). Have a look here: https://askubuntu.com/a/974782/990192

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.