How to change default directory in Windows Subsystem for Linux

You should only change the startingDirectory for WSL (Ubuntu in this case) terminal sessions.

  1. Open settings.json via CTRL+SHIFT+, in Windows Terminal1
  2. Make sure you are modifying startingDirectory under profiles/list/name: "Ubuntu"

Example below (the slashes need to be escaped):

....
{
    "guid": "{2c4de342-xxx-xxx-xxx-2309a097f518}",
    "hidden": false,
    "name": "Ubuntu",
    "source": "Windows.Terminal.Wsl",
    "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\windows_username_in_lower_case"
},
....

Documentation about startingDirectory including default values and expected values.

Inside settings.json you will also find an explanation of the json schema which is here

1 If you need to know how or where to edit Windows Terminal settings/preferences: https://learn.microsoft.com/en-us/windows/terminal/get-started

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)