I want to be able to open a new terminal tab in the current terminal window and run a command in the new terminal tab from a script. Note that I don't want to open an entirely new terminal window, just a new tab.

Running the following opens a new tab as desired, but the echo command gets run in the terminal that executed the script as opposed to getting run in the new tab

xdotool key ctrl+shift+t
echo 'hi'

If there's anyway to do this without using Tmux I'd greatly appreciate it!

1 Answer 1


Newest gnome-terminal versions support

gnome-terminal --tab [-e command ...]
  • Yes I'm aware of this but this isn't what I was looking for. This opens a new terminal window as opposed to a new tab in the current terminal
    – J-Win
    Jul 6, 2019 at 14:33
  • That's what it does in recent versions, e.g. in Ubuntu 19.04.
    – egmont
    Jul 7, 2019 at 7:43
  • Ah I see. I'm still on Ubuntu 16.04
    – J-Win
    Jul 7, 2019 at 15:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .