Skip to content

Instantly share code, notes, and snippets.

@plembo
Created September 23, 2020 01:16
Show Gist options
  • Save plembo/8add3370ee974fd6efa7f617969d88a0 to your computer and use it in GitHub Desktop.
Save plembo/8add3370ee974fd6efa7f617969d88a0 to your computer and use it in GitHub Desktop.
Open WSL Linux home in Windows Terminal

Open WSL Linux home in Windows Terminal

As I write this the latest version of Windows Terminal, an otherwise great program, opens the user's Windows home rather than their Linux home. As many have learned over time, it's fast becoming a best practice to favor the Linux over the Windows file system when working within WSL.

The necessary change is trivial. It only requires the adding of a single line to the Windows Terminal configuration to specify the home directory to open. Here is the syntax:

"startingDirectory": "//wsl$/Ubuntu-18.04/home/username/"

The file that needs to be modified is the settings.json for Windows Terminal located under

C:\Users\username\AppData\Local\Packages\MicrosoftWindowsTerminal_xxxx\LocalState

This is what the profile for WSL Ubuntu 18.04 looks like on my machine:

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

References:

How To Set Windows Terminal Starting Directory for WSL

Let's learn how to move files inside of Linux Root System

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment