11

I know there are options to start a new terminal with a specified title, and that is is possible to change the title from a terminal using the menu: 'Terminal' -> Set Title.

However, I want to change it for a current terminal from command line. How can I change the title for an existing Gnome terminal from command line?

Sander
  • 372

4 Answers4

14

Output a suitable xterm escape sequence.

echo -ne '\033]0;New title\007'

See also How to change the title of an xterm.

l0b0
  • 7,453
tripleee
  • 3,308
  • 5
  • 36
  • 35
1

If you're using Ubuntu 16.04 you may need to clear the PS1 and PROMPT_COMMAND like:

PS1=$
PROMPT_COMMAND=
echo -en "\033]0;New title\a"

I put together a write up on it at link.

1

If you need to set it to the hostname where you are logged into you can use:

echo -ne "\033]0;${HOSTNAME}\007"
0

It might be worth your while to try KDE. It has tabbed terminal windows, and each tab can be named just by right clicking on the tab.

Scott C Wilson
  • 2,454
  • 5
  • 23
  • 33