Setting WSL 2 Start Folder in Windows Terminal - gecko-8/devwiki GitHub Wiki

Up

These steps will show you how to set your WSL 2 start location to the home directory (~) but can be adjusted for any location.

  1. Open your WSL 2 shell.
  2. Type the following command to go to your home directory.
    cd ~
    
  3. Type the following command to get the path of your home folder:
    pwd
    
  4. Open Windows Terminal and open Settings.
  5. In your WSL 2 settings under profiles/list, find the WSL 2 profile.
  6. Note the name of the profile (e.g. Ubuntu-20.04).
  7. Add a line in the profile like this:
    "startingDirectory": "//wsl$/<profile name>/home/<your username>"
    
  8. Save the settings and restart Windows Terminal. You're WSL 2 should now open at the ~ folder.