Setting the Starting Directory for Windows Subsystem for Linux

I use Windows Subsystem for Linux almost every day. I run Ubuntu 20.04 for almost all of my development work. I recently re-installed Windows because I upgraded my PC after many years. One thing that has always bothered me is that when you launch WSL for the first time it doesn’t put you into your user’s home directory. But rather your Windows home directory. The fix for this is really quite simple.

First, navigate to the settings for Microsoft Terminal:

I use Visual Studio Code to do editing. Find the section that contains your WSL installation:

Just below the “source” line, add the following:

"startingDirectory: "//wsl$/Ubuntu-20.04/home/<user>",

Replace “Ubuntu-20.04” with your distro name and “<user>” with your username.

Save and exit!