Set your window title to your current working directory with xterm
The process you use to set your window title to your current working directory depends on the shell you're using:
- If you use
ksh
(Korn Shell), add the following lines to your.profile
file:if test "$TERM" = xterm then PS1='^[]2;$PWD^G^[]1;^G$PWD $ ' fi
To produce the
^[
, press theEsc
key; for the^G
, pressCtrl-g
. If you are using Emacs or vi as your editor, substitute the keystrokes below to reproduce the characters:Emacs: C-q Esc
andC-q C-g
vi: \ Esc
and\ Ctrl-g
- If you use
bash
(GNU Bourne-again Shell), add the following lines to your.bashrc
file:if test "$TERM" = xterm then PROMPT_COMMAND='echo -ne "\033]2;`dirs`\007\033]1;\007"' fi
- If you use
tcsh
(TC shell), add the following lines to your.cshrc
file:if ($?prompt) then if ($term == xterm) then set prompt="%{\e]2\;%~^g\e]1\;%m^g\r%}%m %~%# " endif
- If you use
csh
(C shell), there is no simple way to accomplish this. However, you can change to TC shell with little or no change to your setup.
At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.
This is document aebk in the Knowledge Base.
Last modified on 2023-07-12 11:28:48.