I use
This sets the title of your xterm to the current working directory. But if you're running screen, it also sets the name of this screen 'window' to pwd. Which is great, because now you can hit CTRL-] "
and get a list of all 'windows' and in which directory they are.
A bit like this:
0 root $
1 /home/domm/3united/threeunited.coin.messaging.sms $
2 /home/domm/3united/threeunited.coin.messaging.sms/t/sms_http $
3 /home/domm/3united/threeunited.coin.connectivity/http/de.nextid $
.
.
.
Now it's easy to find the right screen. Yay!
Include the command too
nik on 2006-08-04T15:55:24
I don't know the bash equivalent (I'm sure it has one) but the tcsh man page has a good example (when describing the cwdcmd and postcmd variables) of doing the same thing, but also including the name/arg list of the most recently executed command.
So your xterm/screen title might be:
~/src/> vi foo.c
which I've found invaluable when hunting between different windows.
zsh too
Dom2 on 2006-08-04T16:23:18
In zsh, I stick this in my chpwd() function. Works great!
chpwd () {
[[ -t 1 ]] || return
case $TERM in
xterm*)
print -Pn "\e]0;%m:%~\a" ;;
screen)
print -Pn "\e_%m:%~\e\\"
print -Pn "\ek%m:%~\e\\" ;;
esac
}
# Initialize.
cd $PWD
Hmmm, wish I'd commented on why I have two lines in there for screen... I can't remember now. The [[ -t 1 ]]
bit is to ensure that stdout is a terminal before trying any of this. I don't think that this could get used in that situation, but better safe than sorry.
-Dom