Set the title for GNOME terminal emulator.

Define the title for the current terminal tab
Inspect GNOME terminal source code to identify the escape characters.
[...] TerminalScreen * terminal_screen_new (GSettings *profile, const char *title, double zoom) { g_return_val_if_fail (G_IS_SETTINGS (profile), nullptr); TerminalScreen *screen = (TerminalScreen*)g_object_new (TERMINAL_TYPE_SCREEN, nullptr); terminal_screen_set_profile (screen, profile); vte_terminal_set_size (VTE_TERMINAL (screen), g_settings_get_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY), g_settings_get_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY)); /* If given an initial title, strip it of control characters and * feed it to the terminal. */ if (title != nullptr) { GString *seq; const char *p; seq = g_string_new ("\033]0;"); for (p = title; *p; p = g_utf8_next_char (p)) { gunichar c = g_utf8_get_char (p); if (c < 0x20 || (c >= 0x7f && c <= 0x9f)) continue; else if (c == ';') break; g_string_append_unichar (seq, c); } g_string_append (seq, "\033\\"); vte_terminal_feed (VTE_TERMINAL (screen), seq->str, seq->len); g_string_free (seq, TRUE); } vte_terminal_set_font_scale (VTE_TERMINAL (screen), zoom); terminal_screen_set_font (screen); return screen; } [...]
For more details inspect Operating System Commands
Use echo
to interpret these escape characters and set title for current tab.
$ echo -ne "\033]2;GNOME terminal - tab 3\007"
Define the title for new terminal window
Display help information for gnome-terminal
.
$ gnome-terminal --help-all
Usage: gnome-terminal [OPTION?] [-- COMMAND ?] Help Options: -h, --help Show help options --help-all Show all help options --help-gtk Show GTK+ Options --help-terminal Show terminal options --help-window-options Show per-window options --help-terminal-options Show per-terminal options GTK+ Options --class=CLASS Program class as used by the window manager --name=NAME Program name as used by the window manager --gdk-debug=FLAGS GDK debugging flags to set --gdk-no-debug=FLAGS GDK debugging flags to unset --gtk-module=MODULES Load additional GTK+ modules --g-fatal-warnings Make all warnings fatal --gtk-debug=FLAGS GTK+ debugging flags to set --gtk-no-debug=FLAGS GTK+ debugging flags to unset Options to open new windows or terminal tabs; more than one of these may be specified: --window Open a new window containing a tab with the default profile --tab Open a new tab in the last-opened window with the default profile Window options; if used before the first --window or --tab argument, sets the default for all windows: --show-menubar Turn on the menubar --hide-menubar Turn off the menubar --maximize Maximize the window --full-screen Full-screen the window --geometry=GEOMETRY Set the window size; for example: 80x24, or 80x24+200+200 (COLSxROWS+X+Y) --role=ROLE Set the window role --active Set the last specified tab as the active one in its window Terminal options; if used before the first --window or --tab argument, sets the default for all terminals: -e, --command Execute the argument to this option inside the terminal --profile=PROFILE-NAME Use the given profile instead of the default profile -t, --title=TITLE Set the initial terminal title --working-directory=DIRNAME Set the working directory --wait Wait until the child exits --fd=FD Forward file descriptor --zoom=ZOOM Set the terminal?s zoom factor (1.0 = normal size) Application Options: --load-config=FILE Load a terminal configuration file --no-environment Do not pass the environment --preferences Show preferences window -p, --print-environment Print environment variables to interact with the terminal -v, --verbose Increase diagnostic verbosity -q, --quiet Suppress output --display=DISPLAY X display to use
Define the title for new terminal window.
$ gnome-terminal --title "GNOME terminal"
Simple as that!