The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users
Random tip: Know your mimeset

Title your Terminal pt. II

Contributed by: Haris Ceric
This tip is valid for: Both BeOS and Haiku

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'

Posted in Terminal

Comment on this tip

Comments may be incorporated into the original tip by site editors.

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.