February 19, 2019

Put the path in your xterm titlebar

export PS1=$PS1"\[\e]0;\H:\w\a\]" (bash)

  • October 23, 1999
  • By James Andrews

This alters the prompt to print special escape characters, which xterm uses to set its titlebar. If you are going into a deep directory tree and the path is getting very long, then using the title bar space can be an attractive idea.

A csh version is
alias cd 'chdir \!*;echo -n "^[]0;"`hostname`":" $cwd^G' .

^[ is an escape character; use ctrl V then escape .
^G is a bell.

Most Popular LinuxPlanet Stories