XTerm Titles

Standard disclaimer:  use the information that follows at your own risk.  If you screw up a system, don't blame it on me...
mailto: dkoleary@olearycomputers.com

To update the title bar of an xterm whenever you cd into another directory, enter the following into your ~/.kshrc file:

mcd()
{
   Me=$(whoami)
   Host=$(hostname)
   cd $*
   Pwd=$(pwd)
    echo "<ctrl>-v<ESC>]0;${Me}@${Host}:${Pwd}<ctrl>-v<ctrl>-g\c"
}

alias cd="mcd"

Two minor points:

  • The normal cd<enter> won't work anymore; enter cd ~
  • This function will lock up dtterms.  It'll log in with hpterms (just won't update the title); however, you'll never see a prompt if you're using dtterms.  Use this function if you want to use Xterms only!

  •  
    Document:
    URL:
    Last updated: