GNU screen window title and SSH
If you want to keep track of all your GNU screen sessions, it’s helpful to set the window title to the current machine you ssh‘d into. One way to achieve this is to put this into your .zshrc (.profile should work too):
# Set/reset hostname in screen window title SSH’d machine:
if [ $TERM = "screen" ] ; then
function ssh () {
args=$@
echo -n -e “33k${args##* }33\\”
command ssh “$@”;
echo -n -e “33k${HOST}33\\”
}
# Set it initially for new windows:
echo -n -e “33k${HOST}33\\”
fi
