How to open a new tab in GNOME Terminal from command line? [closed] How to open a new tab in GNOME Terminal from command line? [closed] linux linux

How to open a new tab in GNOME Terminal from command line? [closed]


You can also have each tab run a set command.

gnome-terminal --tab -e "tail -f somefile" --tab -e "some_other_command"


#!/bin/shWID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')xdotool windowfocus $WIDxdotool key ctrl+shift+twmctrl -i -a $WID

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


I found the simplest way:

gnome-terminal --tab -e 'command 1' --tab -e 'command 2'

I use tmux instead of using terminal directly. So what I want is really a single and simple command/shell file to build the development env with several tmux windows. The shell code is as below:

#!/bin/bashtabs="adb ana repo"gen_params() {    local params=""    for tab in ${tabs}    do          params="${params} --tab -e 'tmux -u attach-session -t ${tab}'"    done    echo "${params}"}cmd="gnome-terminal $(gen_params)"eval $cmd