Ubuntu – How to automatically opening terminal windows & tabs, ssh and sudo su

command linegnome-terminalsshsudoworkspaces

When I start my day in front of my computer, I first have to do the following:

  • In workspace 1:
    • Open a new terminal window, ssh loginserver, then ssh serverA1 and sudo su account00
    • Open a new terminal tab, ssh loginserver, then ssh serverA2 and sudo su account00
    • Open a new terminal tab, ssh loginserver, then ssh serverA3 and sudo su account00
  • In workspace 2:
    • Open a new terminal window, 1ssh loginserver, then ssh serverB1 and sudo su account00
    • Open a new terminal tab, ssh loginserver, then ssh serverB2 and sudo su account00
    • Open a new terminal tab, ssh loginserver, then ssh serverB3 and sudo su account00
  • In workspace 3:
    • etc…

Is there a way to automatize the whole process, e.g., having a script that automatically opens each terminal window in its own workspace, all terminal tabs in each window, and all corresponding ssh / sudo su commands? If not, which parts can I automatize?

Best Answer

I would use a bash script for each workspace and add the commands there.

that's the basic idea, then you can add commands like this, where you start a new terminal and run some commands.

and just update your bash file which should be like this filename.sh and mark it executable so you can launch it by just double clicking it.

This could help you launch your commands in a new workspace.