I am setting up my development environment, so I just installed Windows Subsystem for Linux and it always seems to open a fresh terminal in my Windows home directory - /mnt/c/Users/dl
and I'm trying to make it default to the linux home directory - /home/dl
.
I checked to see what the home directory is in the Linux subsystem in /etc/passwd
and it is correctly set:
dl:x:1000:1000:,,,:/home/dl:/bin/bash
Then I came across this solution, but it doesn't seem to have any affect:
// Set starting directory
"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\dl\\"
I know I can just run cd ~
in my dot files (which is what I'm currently using), but I'm looking for a way where /home/dl
is just the default and cd ~
isn't needed. Is this possible?
You should only change the startingDirectory
for WSL (Ubuntu in this case) terminal sessions.
settings.json
via CTRL+SHIFT+, in Windows Terminal1startingDirectory
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