Title your Terminal pt. II
This tip builds on the information in the tip Title your Terminal.
If you’d like the title of your Terminal windows to reflect the current working directory, you need to do two things:
1) Edit your .profile
file (in your home directory) and add the line
PROMPT_COMMAND=~/config/bin/term
2) Create a file called term
(or use any name, just make sure that the PROMPT_COMMAND
from step 1 matches this name) in /boot/home/config/bin
. This file should contain the following code:
echo -e "33]2;`pwd`07"
Restart Terminal, and your title string should be /boot/home
. It will change as you change directories, because PROMPT_COMMAND
will be executed every time you issue a command at the Terminal prompt.
Cash Erler (erlercw@yahoo.com) adds:
Change the echo -e in the script to echo -en
.
This will show the working directory in the titlebar and will not print the extra newline each time (which Terminal doesn’t do normally, and can be annoying)
Peter Folk (pfolk@gargtech.com) adds: The command from this tip wasn’t correctly quoted, so it didn’t make it through the HTML system. The correct command is below:
echo -en '\\033]2;TextInTitle\\007'