remote hostname in terminal title bar?

henksmets

Registered
Does anyone knows how I can put the hostname of the remote host in the terminals title bar? Or change the color of the terminal background?

I often connect to more than one remote server an i would be very handy to see immediatly wich terminal window is connected to wich server.
 
Henksmets,

Do get this to work when logging into a remote server, you need to add that same prompt to the .cshrc or .tcshrc file in your home directory on that remote server. Then it will work.
 
If you're using bash for a shell now that it ships with Jag, add the following lines to ~/.bash_profile and it will update your Terminal title bar, in addition to your shell prompt.

# add me to ~/.bash_profile
# start here
PS1='[\u@\h:\w]\$ '
export TITLEBAR='\[\033]0;\u@\h:\w \007\]'

# Terminal sets TERM_PROGRAM so we can tell it apart from regular VT100
case "$TERM_PROGRAM" in
"Apple_Terminal")PS1="$TITLEBAR$PS1"
esac
case "$TERM" in
"xterm")PS1="$TITLEBAR$PS1"
esac
# end insert

I've been using variants of this on other unixes for many years, and unfortunately lost track of the original author.

jpb
 
Back
Top