Opening New Gnome-Terminal (V3.28+) with Multiple Tabs and Different Commands

Opening multiple tabs in gnome terminal with complex commands from a cycle

I found the solution: arrays. They can do magic.

# initial arguments
command=(gnome-terminal -e 'command "complex argument"')
...
# add extra arguments
command=("${command[@]}" --tab -e 'command "complex argument2"')
...
# execute command
"${command[@]}"

How to execute multiple commands after opening a new terminal tab

Try this:

gnome-terminal -x bash -c "cmd1; cmd2; …cmdN; exec bash"

How to open a new tab in GNOME Terminal from 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.

Open multiple terminal tabs, execute commands and continue working on them

Try this:

gnome-terminal --tab -e 'ls; exec bash'

Or

gnome-terminal --tab -e 'bash -c "ls; exec bash"'

How to choose a default tab focus in gnome-terminal?

I highly recommend installing terminator, it's a program which offers flexible management of multiple running gnome terminals. It allows you to choose a tab as the default focus while still viewing any other amount of terminals on the same view. It can be installed via:

$ sudo apt install terminator


Related Topics



Leave a reply



Submit