Open multiple gnome-terminal tabs and execute commands

Posted: 08/02/2012 in Shell tips
Tags:

I wanted to make a shell script to open a gnome-terminal window with 4 tabs.
The first tab will have title LOCAL and i will work on it on my machine, and the other three will auto connect with ssh to my vps’s and have initial titles.
After some google research i found the solution:

gnome-terminal --tab --title=LOCAL --tab -e "ssh -p 12345 grinux@server1.grinux.com" --title=SERVER1 --tab -e "ssh -p 12345 grinux@server2.grinux.com" --title=SERVER2 --tab -e "ssh -p 12345 grinux@server3.grinux.com" --title=SERVER3

You can use it as a simple shell script or make a desktop shortcut for this.
To prepend title tabs edit your profile in gnome terminal and in the dialog: “When terminal commands set their own titles:” select “Prepend initial title”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s