I know how to load a specific terminal profile as well as loading a config file that the terminal reads, but every time I try to set the title and save the config file, it still returns to the default.

I can only change the window title for that session and only with in the menus. If I try something like gnome-terminal --title="MyTerminal" this brings up a terminal, but the title is still at its default.

How do I change the title from the command line and within a config file?


Looking over the way gome-terminal works, it looks like you need to do a couple things:

  1. Create a new profile, go into Edit -> Current Profile -> Title and Command
  2. Select the option to Keep/Prepend/Append the shell-supplied title (to suit)
  3. Run the command gnome-terminal --title="Wheeee" --profile="The New Profile"

It appears as though the config-file saving is really for session saving (i.e. it stores all your open windows), and it does not save any command-line provided titles, so you can get what you want via a command-line + profile, but not via the config file.

I've taken the liberty of reporting the lack of command-line option saving in the save-config switch against G-T at https://bugzilla.gnome.org/show_bug.cgi?id=645207

  • 2
    Actually using the --title="title" does not really work. It does, but immediately changes back. I had to actually go into edit profile and under title select "Keep Initial Title". Thanks for the info.
    – user5881
    Mar 19 '11 at 21:47

This is a script I wrote a LONG time ago, still in use today, to modify your *n*x title bars on the fly. I still have not figured out how to change profiles on the fly. Maybe this will help though. this script shoud be titled wlabel to work best. See examples

## Copyright (c) 1995, Tim McCoy, Santa Barbara, CA 93111
## Free use and distribution is granted.  Please retain Credits & history
## hplabel (Original name. So named because it was originally created
## for hpterm windows; later modified for sun and linux)
## V 1.0 simple perl script to change an hpterm, xterm, or openlook title
## and icon name to the current directory or as offered on command line.
## V 1.1 Add dtterm, same as xterm (Thanks to Bill Bennett HP-USA)
## V 1.2 renamed to wlabel for Company/personal use.
## V 1.3 Added environmental variable THISWINDOWLABEL detect to retain
##       a window variable regardless of movement 5/1/2000 TAM
## V 1.4 Finally got around to testing openlook; it doesn't work. Commented
## V 1.5 Fix for openbook supplied by Bill Wagner (ecad.rsc.raytheon.com)
## V 1.6 Cool one line addition to permit/use backticks in THISWINDOWLABEL syntax
&usage if ("@ARGV" =~ /\-[(h|H)]+/);

# print "@ARGV\n";
use Cwd;
my $cwd = &cwd();
$text =~ s/\n//g; # avoid chomp by converting '\n' to nil (why ??)
$text = `/bin/echo "$text"` if ($text =~ /\`/);  # cool one line change
chomp $text;
exit if (! $text);
## print STDERR "text='$text' cwd='$cwd'\n";
$term = $ENV{"TERM"};                           # determine term type
if ($term =~ /^(xterm|dtterm)$/i)
  printf "%c]2;%s%c", 27, $text, 7;             # modify the window name
  printf "%c]1;%s%c", 27, $text, 7;             # modify the icon name
elsif ($term eq "hpterm")
  $len = length($text);                         # determine length
  printf "%c&f0k%dD%s", 27, $len, $text;        # modify the window name
  printf "%c&f-1k%dD%s", 27, $len, $text;       # modify the icon name
elsif ($term =~/^(openlook|sun-cmd)$/i)
  printf "%c]l%s%c\\", 27, "$text", 27 ;        # modify the window name
  printf "%c]L%s%c\\", 27, "$text", 27;         # modify the icon name

## This script doesn't need anything else but I use the following alias
## to automatically generate my location to the current window.
## alias cd 'cd \!* ; wlabel'

sub usage
  print '
  Simple little script to put the current working directory in
  the window banner and icon titles.  Replaces the useless
  "Terminal" or "Xterm" text to useful information.  When used
  with a cd alias, it performs this function automatically.

  usage: wlabel [{string}]

  Without arguments wlabel generates the current working directory
  name into the banner/icon.  When followed by a plain text string 
  the string is placed in the banner/icon name.  Additionally, if
  the environmental variable THISWINDOWLABEL is set to a value then
  THAT variables contents will be used for the label.  V1.6 adds
  permitting backticks in the THISWINDOWLABEL string. (i.e.; 
  setenv THISWINDOWLABEL '."'`hostname`:`pwd` `date +\"%T\"`'".'
  will yield something like: "myhost:/net/myhome/dir 08:40:07"


  % wlabel
  # banner/icon is "/your/current/working/directory"
  % wlabel verilog
  # banner/icon is "verilog"
  % setenv THISWINDOWLABEL "common window"
  # banner/icon still says "verilog"
  % wlabel
  # banner/icon is "common window"


  Telnet windows to other machines will NOT update the banners.
  In fact if the cd alias (described below) is used during a telnet
  session it may generate errors if the wlabel utility is not in the path.
  ( If so then just "unalias cd" )


  put this alias in your .cshrc file to automate wlabel:
  % alias cd "cd \!* ; ~/bin/wlabel";

  And, if the icon text does NOT expand to the full label name when
  the cursor passes over it, try adding this to your .Xdefaults file:
  Dtfile*desktopIcon:     large
  I think this is the one I set to make it work right.  (TAM 7/3/01)
  exit 0;

I just answered a very similar question here: https://askubuntu.com/questions/30988/how-do-you-set-the-title-of-the-active-gnome-terminal-from-the-command-line/31004#31004

Basically, you can set the title in your ~/.bashrc file, but you need to change PS1 environment variable so it doesn't override you by automatically setting the title/icon-name itself. Take a look at the instructions I posted there, and if you can't figure it out from there, or run into any problems, let me know and I'll walk you through it.

  • 1
    Actually, I don't want to change all the terminal titles, just one launcher. Still that other discussions looks useful and I will look into it sometime. Thanks.
    – user5881
    Mar 19 '11 at 21:50

I was looking for the same and ended up with an obvious solution when I tried (luckily). The case is that you have saved your session in a config file. Then you start it with gnome-terminal --load-config=mysetup.txt

The config file is in an obvious form, with each tab on a different "paragraph" title with something like this : [Terminal0x24db600] You search for the tab that you want to change and add a simple : Title=my tab name

That's all folks !! This way you control everything, either in window level or per tab. You can arrange different profiles for any tab and adapt the result in here.


I'm running Ubuntu 14.04 and had to do 1 additional step on top on MiGrieves' suggestion, which I'd read about here - https://askubuntu.com/a/387313 In short, I had to go to Edit -> Profile Preferences -> Title and Command and choose "Keep initial title" in the dropdown. I left the "Terminal" in the "Initial Title" field though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.