change gnome-terminal "title" from cmdline

Phil Meyer pmeyer at themeyerfarm.com
Tue Sep 29 21:55:07 UTC 2009


On 09/26/2009 10:42 PM, bruce wrote:
> hey...
>
> curious question...
>
> how does one go about changing the title of the current gnome-terminal via
> the cmdline...
>
> it appears that the escape sequences i've tried aren't working...
>
> thoughts/comments/pointers appreciated...
>
> thanks
>
>    

Here is a bit of my .tcshrc that does this.  The escape codes here 
should be obvious, and are the same for most terminal emulators, such as 
xterm and kterm:

         set prompt = "%m {%h} %t %U%~%u "
         if ( $TERM == "xterm" || $TERM == "dtterm" || $TERM == "kterm" 
) then
#               set color ls
                 set term_esc = "^[]2;" # escape, right bracket, 2, 
semi-colon.
                 set esc_end = "^G" # Control G
                 alias precmd 'echo -n "${term_esc} ${HOST}:${cwd} 
${esc_end} "'

         endif

This puts the host name and current working directory on my terminal 
title bar.  Even when logged in remotely, which is the point for me.  
Just hafta to know for sure before typing 'sudo reboot'!

Good luck!




More information about the fedora-list mailing list