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.

1

2 Answers 2

5

try this

//it opens up a window with a tab

gnome-terminal --window --tab

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but I'm trying to avoid opening more windows. I want the tab to open in the existing window.
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).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.