How To Set Windows Terminal Starting Directory for WSL

Now that Windows 10 Slow Ring builds have WSL2 I’ve been doing more dev work on my Windows computer (VS Code Remote WSL is really good y’all).

I wanted to give the new Windows Terminal a go and the first thing I noticed is that when I open WSL in windows terminal it defaults to my home folder on Windows /mnt/c/Users/wes. If you are like me you want it to start in your linux home directory /home/wes not your Windows home folder.

The fix

To fix it you need to modify the settings.json file of Windows Terminal (which you can open with keyboard shotrcut: Ctrl + ,).

Once in the settings json file find the WSL entry and set the startingDirectory to the network path of your WSL home directory:

    "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e43243e40}",
    "hidden": false,
    "name": "Ubuntu-18.04",
    "source": "Windows.Terminal.Wsl",
    "startingDirectory": "//wsl$/Ubuntu-18.04/home/wes/"

Now when you launch WSL in the terminal it will start in good old ~

WSL Home Directory

I’ve only tested this with WSL2 but I think it’s the same for WSL1

NOTE: Setting a non-network path won’t work

The Windows Terminal only knows about paths from Windows’ perspective, so if you try to put in the home directory path directly it won’t work:

Home path not set

Hopefully you found this post helpful, if you have any questions you can find me on Twitter.

How to Build a PWA without a Build Step How To Password Protect Your Staging Site on Netlify