To save configuration into /tmp/cfg
:
gnome-terminal --save-config=/tmp/cfg
To load it back:
gnome-terminal --load-config=/tmp/cfg
UPDATE
After playing around with bash I created following script which stores tab names into file /tmp/test
as well:
#!/usr/bin/env bash
gnome-terminal --save-config=/tmp/test
LINES=($(grep -n '\[Terminal' /tmp/test | cut -d: -f1))
for ((i=0; i<$(grep '\[Terminal' /tmp/test | wc -l); i++))
do
TITLE=$(xprop -id $WINDOWID WM_NAME | sed -e 's/WM_NAME(STRING) = "//' -e 's/"$//';xdotool key ctrl+Page_Down;)
sed -ri "$((${LINES[$i]}+$i))s/.*/&\nTitle=$TITLE/" /tmp/test
done
To assign names properly you have to run it from first tab of your terminal. Loading same as before:
gnome-terminal --load-config=/tmp/test
EXPLANATION:
I can use following to get tab name:
xprop -id $WINDOWID WM_NAME
I can use following to jump to next tab:
xdotool key ctrl+Page_Down;
I'm getting number of tabs after grepping configuration file I saved before:
$(grep '\[Terminal' /tmp/test | wc -l)
So I can iterate over tabs inside a loop. I have to add "Title=titlename" entry for each tab configuration section in file saved before. To do so, first I'm creating an array of line numbers where I'll be adding lines.
LINES=($(grep -n '\[Terminal' /tmp/test | cut -d: -f1))
I'm adding "Title=titlename" line inside of loop iterating over tabs:
sed -ri "$((${LINES[$i]}+$i))s/.*/&\nTitle=$TITLE/" /tmp/test
Just this command will do:
gnome-terminal
Normally if you want a command to open from the terminal and separate (so it returns to the prompt without having to close the opened program), you have to use something like this:
gnome-terminal & disown
However the parent terminal seems to detect that the same command is being used so you don't need to do that and gnome-terminal
will suffice. This also seems to happen when running xfce4-terminal
from Xfce's terminal, konsole
from KDE's as well (doesn't seem to work when running xterm
from xterm
(see also xterm xterm
) - Running konsole
from Gnome/Unity & Xfce's terminal works as well, but for Xfce's terminal in gnome terminal you need xfce4-terminal & disown
).
For more visit gnome-terminal
's manual page:
gnome-terminal [-e, --command=STRING] [-x, --execute ] [--window-with-profile=PROFILENAME] [--tab-with-profile=PRO‐
FILENAME] [--window-with-profile-internal-id=PROFILEID] [--tab-with-profile-internal-id=PROFILEID] [--role=ROLE]
[--show-menubar] [--hide-menubar] [--geometry=GEOMETRY] [--disable-factory] [-t, --title=TITLE] [--working-direc‐
tory=DIRNAME] [--usage] [-?, --help]
Best Answer
Press Ctrl+Shift+N in gnome-terminal for a new terminal window.
Press Ctrl+Shift+T in gnome-terminal for a new terminal tab.
Or right click in the terminal and chose
New Terminal
orNew Tab
The new terminal window or tab inherits the working directory from its parent terminal.
This works also with the Xfce terminal.
LXTerminal only inherits the working directory from its parent terminal on a new tab.