How to open new tab in the current gnome-terminal window

gnome-terminalzsh

I ran gnome-terminal --working-directory=$DIR but it opens in a new window, not tab.

Things I've tried:

--tab
-T
--add-tab

Running RHEL5 with zsh

Best Answer

Verbatim copy of the only way to do this that I've ever seen, using xdotool, xprop, & wmctrl.

Source: Open a new tab in gnome-terminal using command line
#!/bin/sh

WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID
xdotool key ctrl+shift+t
wmctrl -i -a $WID

This will auto determine the corresponding terminal and opens the tab accordingly.