Published 2025-08-14.
Time to read: 1 minutes.
wsl
collection.
These are my notes on Microsoft Terminal. This free product is the best general-purpose terminal emulator available for Microsoft Windows. I prefer to run the Preview edition; it has never failed me.
Linux Starting Directory
To launch a new terminal session from the same directory as another session, duplicate it by pressing CTRL-SHIFT-D.
Alternatively, you could open a new pane within the same tab, while duplicating the Windows Terminal profile and working directory. To do this, you can either split the session verticallly by pressing ALT-SHIFT-=, or you can split it horizontally by pressing ALT-SHIFT--.
Automatic Tab Titles
Several settings need to be in place before the titles of the tabs will respond to requests from the terminal session.
Microsoft Terminal Settings
The Default profile and the Linux / bash profiles such as Ubuntu must have:
- Tab title set to None.
- Terminal Emulation / Suppress title changes must be disabled.
The above settings take effect immediately so long as they are not masked by other settings.
Linux Settings
-
Remove or comment out every line that sets the
PS1
andPROMPT_COMMAND
environment variables in~/.bashrc
and~/.profile
. -
Add the following to
~/.bashrc
:
~/.bashrc fragmentRED="\[\033[0;31m\]" YELLOW="\[\033[0;33m\]" GREEN="\[\033[0;32m\]"
function parse_git_branch { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "("${ref#refs/heads/}")" }
PS1="$GREEN\h: \u@\h \W $YELLOW\$(parse_git_branch)\n\[\033[00m\]\$ " PROMPT_COMMAND='echo -en "\033]0;$HOSTNAME: $(basename ${PWD/#$HOME/~})\a"'The above settings will take effect when a new terminal session starts or when the following command is executed:
Shell$ source ~/.bashrc
The wt.exe Command Line Interface
You can use the
wt.exe
command-line
to perform tasks like open a new tab or pane in the current directory.
For example:
$ wt.exe -w 0 nt -d .
Where:
-w 0
- Specifies to use the current terminal window.nt or new-tab
- Creates a new tab. You can also usesp
orsplit-pane
for a new pane.-d .
- Sets the starting directory to the current directory.