This is an issue raised on Microsoft Terminal's GitHub Page in Windows Terminal as startingDirectory setting issue for wsl profile #592 . And not respecting things is a hobby of some things.
Actually it seems that
startingDirectory Windows Terminal doesn't work well under WSL fs paths since the issue isn't specific to
$HOME, it exists for all folders in
While the user3140225's approach is a good start but as per DHowett-MSFT's comment:
This is also a great way to get weird and unexpected behaviour in everything else that uses bash on your machine. 😄
Since in Ubuntu's profile you've provided the command line
wsl.exe -d Ubuntu. This command line invokes WSL and ask it to start "Ubuntu" which is done in the current directory, i.e. if you run
wsl.exe -d Ubuntu while in Desktop of Windows, Ubuntu will start on Windows' Desktop.
As a workaround, you can modify the command line and use one of the below.
Since WSL is specifically for Linux, thus Tilde Expansion can be expected from that. Therefore, you can specify the "starting directory" in the command line and use the following as the value of command line.
wsl.exe ~ -d ubuntu
When Ubuntu app is installed, it automatically registers
ubuntu command. Therefore,
ubuntu command will invoke Ubuntu App. The benefit of this is that it always starts at
$HOME. Therefore, you can change the value of command-line to
Note: If you are using Ubuntu 18.04 or 16.04 app, the command would vary accordingly. The above is only for Ubuntu App.
If you're uncomfortable in changing command-line, you can still get it to work by modifying
Credits: caksoylar 's comment