

A Google search for "howto set terminal title" yields quite a number of pointers to how to do this, including this: http://www.faqs.org/docs/Linux-mini/Xterm-Title.htmlqleak wrote:Does anyone know a command line way to set the title of a terminal window. I've noticed emerge does this but its a matter of convenience so I don't want to spend forever looking for it.
Code: Select all
echo "\033]0;the terminal title you want\007"ZZamboni wrote:This doesn't seem to work in xterm, not to mention gnome-terminal. Infact if i use the xterm -T"title" at the command line it gets replaced by the default title user@host /pwd Same thing with gnome-terminal. Looks like a bunch of people with unanswered questions on the link you gave too.qleak wrote: In a nutshell, it's this:See also this thread: http://forums.gentoo.org/viewtopic.php?t=18106Code: Select all
echo "\033]0;the terminal title you want\007"
I do actually want this to be a command line way of doing this so I can add it to my custom scripts I run for work.
thanks for the suggestions,
-Q

Thats most likely because the default prompt on Gentoo automatically sets the terminal title to "user@host pwd", so in fact it is working, but it is immediately being set again to the default after the command executes, when the prompt reappears. You can test that this is the case by resetting the prompt commands:qleak wrote:This doesn't seem to work in xterm, not to mention gnome-terminal. Infact if i use the xterm -T"title" at the command line it gets replaced by the default title user@host /pwd Same thing with gnome-terminal.
Code: Select all
export PROMPT_COMMAND=
export PS1="$"

I accidentally omitted the -ne options to the echo command, which are needed for the escapes to be interpreted correctly and to omit spurious output. This is the command you need:qleak wrote:even with changing the command line the echo command does not work on either xterm or gnome-terminal. Any other ideas?
Code: Select all
echo -ne "\033]0;the terminal title you want\007"ahh thanks. I did actually try the -ne option but failed to do so after exporting the variables.ZZamboni wrote:I accidentally omitted the -ne options to the echo command, which are needed for the escapes to be interpreted correctly and to omit spurious output. This is the command you need:qleak wrote:even with changing the command line the echo command does not work on either xterm or gnome-terminal. Any other ideas?<rant>With all due respect, you could have looked at the document to which I pointed you, and found the solution there, including the options above, and not wait for me to give you all the answers already digested.</rant>Code: Select all
echo -ne "\033]0;the terminal title you want\007"
Code: Select all
#!/bin/bash
export PROMPT_COMMAND=
export PS1="$"
echo -ne "\033]0;GAP\007"
FILE="/usr/local/src/gap4r4/save_X.gap"
[ -z "$DISPLAY" ] && FILE="/usr/local/src/gap4r4/save.gap"
/usr/local/src/gap4r4/bin/gap.sh -L $FILE $*
tw04l124 also suggested this. I also was aware of this option, but it takes time to change the window title every time I run a program. I wanted it to be automatic with specific programs that are important to me.Mythos wrote:ummm gnome-terminal -> Terminal -> Set Title ?