Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open new tabs in gnome-terminal from script

I know I can right-click > open tab to open a new tab in gnome-terminal, but how can I do the same from a script? If i use 'gnome-terminal --tab-with-profile=...' it opens a new window.

I need this to be able to open multiple ssh sessions, in tabs, to servers I manage. I don't see any option in ssh to open new sessions in tabs.

I have two different gnome-terminal profiles, a profile 'local' i used for local terminals and a profile 'server' I use for terminals connected to production servers, so it is easy to see which is which. I could open a gnome-terminal, then right-click, open a tab, right-click again and set it to a different profile, then run an ssh command (with switches for non-standard port, key file etc) - but I'd like to condense this into an alias or script for convenience. Hope this clarifies the situation.

like image 912
Dokbua Avatar asked Oct 03 '22 15:10

Dokbua


1 Answers

try this

//it opens up a window with a tab

gnome-terminal --window --tab

like image 50
cafebabe1991 Avatar answered Oct 07 '22 19:10

cafebabe1991