How to open new tabs in gnome-terminal from script
Asked Answered
L

2

6

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.

Lachish answered 21/10, 2013 at 7:44 Comment(1)
Duplicate of #1189459Amon
G
5

try this

//it opens up a window with a tab

gnome-terminal --window --tab

Grateful answered 21/10, 2013 at 7:53 Comment(1)
Thanks, but I'm trying to avoid opening more windows. I want the tab to open in the existing window.Lachish
N
2

In the version of gnome-terminal in Ubuntu 14 (v3.6?), the command gnome-terminal --tab opens a separate window.

I'm not sure when the behavior changed exactly, but at least as of gnome-terminal v3.28 (Ubuntu 18), gnome-terminal --tab will open a new tab in the current terminal (despite the documentation saying it will open it in the most recently opened window). In this version the additional option --window is needed to open a separate window (ie. gnome-terminal --window --tab).

Neuropathy answered 11/10, 2018 at 15:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.