4

Is this possible at all? (basically a pendant to cmd.exe's title command that Mikel's answer mentions, although I'd prefer changing the entire tab name instead of adding a window title)

2 Answers2

4

In bash, the standard Xterm sequences documented at How to change the title of an xterm seem to work, e.g.

echo -e "\033]0;custom title\007"; cat

So try adding that to your PS1 in your .bashrc or whichever config file you use, e.g:

PS1="\033]0;\$PWD\007$PS1"

or use PROMPT_COMMAND instead if you are using bash.


In cmd.exe, you can use title <string> to set the title.

You would chain it together using a doskey alias like this:

doskey cd=title $1 ^&^& cd $1

Then set it to load for every new cmd using the instructions in Loading DOSKEY Automatically with CMD.


In both cases, to show only the window title, go to Settings->Appearance and tick the
Use console window title* box.

Mikel
  • 9,184
1

Been a while, but the only post that mostly answered my problem
Building on the answer from Mikel and the comment from Tobias, adding

PS1='\[\033]2;\u:\w\007\]'$PS1

to ~/.bashrc allowed consoleZ (successor to console2) to show the shell title in the consoleZ tab, and not mess up line wrapping in the shell.

"Note the use of \[...\], which tells bash to ignore the non-printing control characters when calculating the width of the prompt. Otherwise line editing commands get confused while placing the cursor."
http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss4.3