How to change the home directory of Linux running on Windows Terminal with WSL(2)


When imported by WSL, the directory at startup is inherited from the current directory on Windows side as follows.

PS C:\Users\jun> wsl -d ubuntu2004-1

This is so annoying.
So we want to specify the home directory.
Open the settings.

(Sorry, Japanese UI.)


Or edit the following file.
(I think the name is a little different because it’s the Preview version.)


“source”: “Windows.Terminal.Azure”

Specify the directory where you want to specify the startingDirectory as shown below.

//wsl$/[distribution name]/[directory to be specified]/{
// Put settings here that you want to apply to all profiles.
"guid": "{61e194fe-f841-5cd8-b7dd-1480bff5b6cc}",
"hidden": false,
"name": "ubuntu2004-1",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/ubuntu2004-1/root/"

If I set it up as above, I could not change the installation from the store to the home directory.
It’s a bit dirty, but you can specify it by setting it as follows. This is also valid for those imported with the WSL command.
If you want to unify the description, this is a good way to use it.

"startingDirectory": "\\\\wsl$\\Ubuntu-18.04\\home\\jun"

The commandline wsl command

To use the WSL command, add ~(tilde).

"name": "ubuntu2004-1-cmd",
"commandline": "wsl ~ -d ubuntu2004-1",
"hidden": false


That was a brief explanation.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jun Kudo

Jun Kudo


I’m Japanese, Microsoft MVP for Azure. Alibaba Cloud MVP. Cloud Solution Architect. Azure, AWS, GCP, and Alibaba Cloud.