Changing Ubuntu WSL starting directory keeps it set to the defualt #3855

Closed
opened 2026-01-30 23:31:40 +00:00 by claunia · 78 comments
Owner

Originally created by @AlikanakelaKarwowski on GitHub (Sep 13, 2019).

Originally assigned to: @bitcrazed on GitHub.

When editing the the settings, I have tried to chang the default starting directory for the Ubuntu WSL Terminal profile as follows
"startingDirectory": "/mnt/D/Folder/SubFolder/",
and while it doesnt cause any issues or causes the Terminal to resort to default configuration, it does not set the default starting directory to the specified path.

Also it seems that most settings for the profile do literally nothing when changing them, from color, to acrylic or scheme settings.

Note: changing the setting for power shell, cmd, of Kali-Linux does work and change things respectively

Originally created by @AlikanakelaKarwowski on GitHub (Sep 13, 2019). Originally assigned to: @bitcrazed on GitHub. When editing the the settings, I have tried to chang the default starting directory for the Ubuntu WSL Terminal profile as follows `"startingDirectory": "/mnt/D/Folder/SubFolder/",` and while it doesnt cause any issues or causes the Terminal to resort to default configuration, it does not set the default starting directory to the specified path. Also it seems that most settings for the profile do literally nothing when changing them, from color, to acrylic or scheme settings. Note: changing the setting for power shell, cmd, of Kali-Linux does work and change things respectively
Author
Owner

@zadjii-msft commented on GitHub (Sep 13, 2019):

startingDirectory Should be a windows path, not a *nix path. Try D:\Folder\SubFolder instead.

Could you be specific which settings don't seem to work for that profile? Maybe share the profile from the profiles.json file?

@zadjii-msft commented on GitHub (Sep 13, 2019): `startingDirectory` Should be a _windows_ path, not a *nix path. Try `D:\Folder\SubFolder` instead. Could you be specific which settings don't seem to work for that profile? Maybe share the profile from the `profiles.json` file?
Author
Owner

@bitcrazed commented on GitHub (Sep 13, 2019):

@zadjii-msft Just checked into this & verified that, yes, specifying a Windows path does work, and for WSL distros, specifying a Windows-relative path to a distro also works.

For example, \\\\wsl$\Ubuntu\home\\rich\\ opens my Ubuntu home folder! 😁

@bitcrazed commented on GitHub (Sep 13, 2019): @zadjii-msft Just checked into this & verified that, yes, specifying a Windows path does work, and for WSL distros, specifying a Windows-relative path to a distro also works. For example, `\\\\wsl$\Ubuntu\home\\rich\\` opens my Ubuntu home folder! 😁
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 14, 2019):

This is a duplicate of another bug in the db somewhere. We need to clarify in the documentation that startingDirectory is a Windows path, and since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff.

It's gotta be a Windows path. 😄

I'm re-tagging this with Issue-Docs

@DHowett-MSFT commented on GitHub (Sep 14, 2019): This is a duplicate of another bug in the db somewhere. We need to clarify in the documentation that `startingDirectory` is a _Windows_ path, and since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff. It's gotta be a Windows path. :smile: I'm re-tagging this with `Issue-Docs`
Author
Owner

@MEXdave1997 commented on GitHub (Sep 19, 2019):

I am working on submitting a PR to add that bit of detail, if that is alright with everyone.

@MEXdave1997 commented on GitHub (Sep 19, 2019): I am working on submitting a PR to add that bit of detail, if that is alright with everyone.
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 19, 2019):

Sure!

@DHowett-MSFT commented on GitHub (Sep 19, 2019): Sure!
Author
Owner

@contento commented on GitHub (Nov 6, 2019):

@zadjii-msft Just checked into this & verified that, yes, specifying a Windows path does work, and for WSL distros, specifying a Windows-relative path to a distro also works.

For example, \\\\wsl$\Ubuntu\home\\rich\\ opens my Ubuntu home folder! 😁

You may want to use wsl -l first, in order to determine which Ubuntu version you are running.
For example:
"startingDirectory": "\\\\wsl$\\Ubuntu-18.04\\home\\[linux-user]"

@contento commented on GitHub (Nov 6, 2019): > @zadjii-msft Just checked into this & verified that, yes, specifying a Windows path does work, and for WSL distros, specifying a Windows-relative path to a distro also works. > > For example, `\\\\wsl$\Ubuntu\home\\rich\\` opens my Ubuntu home folder! 😁 You may want to use `wsl -l` first, in order to determine which Ubuntu version you are running. For example: `"startingDirectory": "\\\\wsl$\\Ubuntu-18.04\\home\\[linux-user]"`
Author
Owner

@jgroom33 commented on GitHub (Feb 9, 2020):

non-escaped also works:

"startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>"
@jgroom33 commented on GitHub (Feb 9, 2020): non-escaped also works: ```json "startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>" ```
Author
Owner

@Boobies commented on GitHub (Feb 27, 2020):

The problem isn't the documentation, it's the default JSON provided. That's why everyone keeps complaining about the same thing. Here's mine:

        "startingDirectory" : "\\\\wsl$\\Debian\\home\\<linuxuser>"

which instead takes me to /mnt/c/Users/<windowsuser>. So it looks like that string is entirely ignored and a default that has nothing to do with it is picked. It's not even the same username.

@Boobies commented on GitHub (Feb 27, 2020): The problem isn't the documentation, it's the default JSON provided. That's why everyone keeps complaining about the same thing. Here's mine: "startingDirectory" : "\\\\wsl$\\Debian\\home\\<linuxuser>" which instead takes me to `/mnt/c/Users/<windowsuser>`. So it looks like that string is entirely ignored and a default that has nothing to do with it is picked. It's not even the same username.
Author
Owner

@MEXdave1997 commented on GitHub (Feb 27, 2020):

@Boobies weirdly enough, I've used "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\[linux username]" in my config for a while now with no issue. Could there be any other setting that might be conflicting with it?

@MEXdave1997 commented on GitHub (Feb 27, 2020): @Boobies weirdly enough, I've used `"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\[linux username]"` in my config for a while now with no issue. Could there be any other setting that might be conflicting with it?
Author
Owner

@amykapernick commented on GitHub (Feb 27, 2020):

I've tried all of these and it still seems to be defaulting to c/Users/{user} as well. Any suggestions?

@amykapernick commented on GitHub (Feb 27, 2020): I've tried all of these and it still seems to be defaulting to `c/Users/{user}` as well. Any suggestions?
Author
Owner

@kybrdbnd commented on GitHub (Mar 1, 2020):

I've tried all of these and it still seems to be defaulting to c/Users/{user} as well. Any suggestions?

start by using this -> //wsl$/Ubuntu/ and then recursively find the directory where you want to go.
If you wanna change drives like go to D:/ its not picking up, moreover you can change to your starting directory whose write access is done by root. Check the folder permission also by using ls -l if its root it can be your startingDirectory else not possible right now

@kybrdbnd commented on GitHub (Mar 1, 2020): > I've tried all of these and it still seems to be defaulting to `c/Users/{user}` as well. Any suggestions? start by using this -> `//wsl$/Ubuntu/` and then recursively find the directory where you want to go. If you wanna change drives like go to D:/ its not picking up, moreover you can change to your starting directory whose write access is done by root. Check the folder permission also by using `ls -l` if its root it can be your startingDirectory else not possible right now
Author
Owner

@tnguyen14 commented on GitHub (Mar 30, 2020):

@bitcrazed

For example, \\wsl$\Ubuntu\home\rich\ opens my Ubuntu home folder! 😁

I did this, and it works for me, but now I get this message every time I create a new window

wslpath: '\\wsl$\WLinux\home\tnguyen14'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
C:\Users\NguyenTri

It still cd to the right directory though. Is this error message expected? Any way I can fix it?

@tnguyen14 commented on GitHub (Mar 30, 2020): @bitcrazed > For example, \\\\wsl$\Ubuntu\home\\rich\\ opens my Ubuntu home folder! 😁 I did this, and it works for me, but now I get this message every time I create a new window ``` wslpath: '\\wsl$\WLinux\home\tnguyen14' CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory. C:\Users\NguyenTri ``` It still cd to the right directory though. Is this error message expected? Any way I can fix it?
Author
Owner

@zadjii-msft commented on GitHub (Mar 30, 2020):

@tnguyen14 what commandline are you using to launch wsl?

@zadjii-msft commented on GitHub (Mar 30, 2020): @tnguyen14 what `commandline` are you using to launch `wsl`?
Author
Owner

@tnguyen14 commented on GitHub (Mar 30, 2020):

@zadjii-msft The Windows Terminal app - is that what you meant?

@tnguyen14 commented on GitHub (Mar 30, 2020): @zadjii-msft The Windows Terminal app - is that what you meant?
Author
Owner

@zadjii-msft commented on GitHub (Mar 30, 2020):

I meant the commandline in your profiles.json file - could you share that with me?

@zadjii-msft commented on GitHub (Mar 30, 2020): I meant the `commandline` in your `profiles.json` file - could you share that with me?
Author
Owner

@tnguyen14 commented on GitHub (Mar 30, 2020):

It's not specified. Here's the profile object:

        {
            "guid": "{7f586916-8357-53d4-bb2b-ca96f639898a}",
            "hidden": false,
            "name": "WLinux",
            "source": "Windows.Terminal.Wsl",
            "fontSize": 10,
            "fontFace": "SauceCodePro NF",
            "startingDirectory": "//wsl$/WLinux/home/tnguyen14",
            "padding": "0, 0, 0, 0"
        },
@tnguyen14 commented on GitHub (Mar 30, 2020): It's not specified. Here's the profile object: ``` { "guid": "{7f586916-8357-53d4-bb2b-ca96f639898a}", "hidden": false, "name": "WLinux", "source": "Windows.Terminal.Wsl", "fontSize": 10, "fontFace": "SauceCodePro NF", "startingDirectory": "//wsl$/WLinux/home/tnguyen14", "padding": "0, 0, 0, 0" }, ```
Author
Owner

@zadjii-msft commented on GitHub (Mar 30, 2020):

Okay, well that's exactly what I'd expect that to look like. I'm not sure why that error message is getting displayed, but you might be able to get answers over at https://github.com/microsoft/WSL

@zadjii-msft commented on GitHub (Mar 30, 2020): Okay, well that's exactly what I'd expect that to look like. I'm not sure why that error message is getting displayed, but you might be able to get answers over at https://github.com/microsoft/WSL
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 30, 2020):

This is because wslu, the WSL integration bridge that ships with Ubuntu, is running cmd.exe on startup. There's nothing we can do about that. This will happen any time WSL is started outside of the Windows filesystem.

@DHowett-MSFT commented on GitHub (Mar 30, 2020): This is because `wslu`, the WSL integration bridge that ships with Ubuntu, is running `cmd.exe` on startup. There's nothing we can do about that. This will happen any time WSL is started outside of the Windows filesystem.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 30, 2020):

More info here: https://github.com/microsoft/terminal/issues/4214

@DHowett-MSFT commented on GitHub (Mar 30, 2020): More info here: https://github.com/microsoft/terminal/issues/4214
Author
Owner

@tnguyen14 commented on GitHub (Mar 30, 2020):

@DHowett-MSFT Interesting. I don't see if from windows when I use other terminal apps, like wsltty or the default Pengwin app - is that launched differently somehow?

@tnguyen14 commented on GitHub (Mar 30, 2020): @DHowett-MSFT Interesting. I don't see if from windows when I use other terminal apps, like wsltty or the default Pengwin app - is that launched differently somehow?
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 30, 2020):

Depends. What do you get when you run pwd immediately after launching it in those other applications?

@DHowett-MSFT commented on GitHub (Mar 30, 2020): Depends. What do you get when you run `pwd` immediately after launching it in those other applications?
Author
Owner

@tnguyen14 commented on GitHub (Mar 30, 2020):

the regular linux /home/myuser path.
I know for the wsltty app, the "Target" property of the launcher is set to this value:

C:\Users\NguyenTri\AppData\Local\wsltty\bin\mintty.exe --WSL= --configdir="C:\Users\NguyenTri\AppData\Roaming\wsltty" -~ 
@tnguyen14 commented on GitHub (Mar 30, 2020): the regular linux `/home/myuser` path. I know for the wsltty app, the "Target" property of the launcher is set to this value: ``` C:\Users\NguyenTri\AppData\Local\wsltty\bin\mintty.exe --WSL= --configdir="C:\Users\NguyenTri\AppData\Roaming\wsltty" -~ ```
Author
Owner

@tnguyen14 commented on GitHub (Mar 31, 2020):

@DHowett-MSFT do you know if that same behavior can be replicated?

@tnguyen14 commented on GitHub (Mar 31, 2020): @DHowett-MSFT do you know if that same behavior can be replicated?
Author
Owner

@wmertens commented on GitHub (Apr 2, 2020):

@DHowett-MSFT you said

since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff.

But that doesn't make sense because Terminal knows to start WSL with the correct container purely based on the UUID (I presume?), there is nothing else in the entry that says which WSL container to open, and I can actually change the name and the path. Here's my Ubuntu install, I can say it's Alpine and it will still load Ubuntu with the correct path, but I can't say //wsl/$/Whatever so it needs to be the name of an existing install:

      {
        "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
        "hidden": false,
        "name": "Whatever",
        "startingDirectory": "//wsl$/Alpine/home/wmertens/",
        "source": "Windows.Terminal.Wsl"
      }
@wmertens commented on GitHub (Apr 2, 2020): @DHowett-MSFT you said > since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff. But that doesn't make sense because Terminal knows to start WSL with the correct container purely based on the UUID (I presume?), there is nothing else in the entry that says which WSL container to open, and I can actually change the name and the path. Here's my Ubuntu install, I can say it's Alpine and it will still load Ubuntu with the correct path, but I can't say `//wsl/$/Whatever` so it needs to be the name of an existing install: ```json { "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", "hidden": false, "name": "Whatever", "startingDirectory": "//wsl$/Alpine/home/wmertens/", "source": "Windows.Terminal.Wsl" } ```
Author
Owner

@mbursill commented on GitHub (Apr 20, 2020):

I edited .bashrc and added cd ~ to the end. Good enough for my needs.

@mbursill commented on GitHub (Apr 20, 2020): I edited `.bashrc` and added `cd ~` to the end. Good enough for my needs.
Author
Owner

@trialuser commented on GitHub (Apr 25, 2020):

I edited .bashrc and added cd ~ to the end. Good enough for my needs.

sometimes it makes your work uncomfortable, because cd ~ will be executed each time when you run .bashrc (e.g. with sudo username or just bash). For example, when you are in some specific directory switch between different shells - you will be moved to the home directory once you run bash :|

@trialuser commented on GitHub (Apr 25, 2020): > > > I edited `.bashrc` and added `cd ~` to the end. Good enough for my needs. sometimes it makes your work uncomfortable, because `cd ~` will be executed each time when you run .bashrc (e.g. with `sudo username` or just `bash`). For example, when you are in some specific directory switch between different shells - you will be moved to the home directory once you run bash :|
Author
Owner

@krlinus commented on GitHub (Apr 26, 2020):

I edited .bashrc and added cd ~ to the end. Good enough for my needs.

sometimes it makes your work uncomfortable, because cd ~ will be executed each time when you run .bashrc (e.g. with sudo username or just bash). For example, when you are in some specific directory switch between different shells - you will be moved to the home directory once you run bash :|

Instead of ~/.bashrc it can be put in /etc/bashrc or /etc/bash.bashrc (whichever is present) if it is sourced less often

@krlinus commented on GitHub (Apr 26, 2020): > > I edited `.bashrc` and added `cd ~` to the end. Good enough for my needs. > > sometimes it makes your work uncomfortable, because `cd ~` will be executed each time when you run .bashrc (e.g. with `sudo username` or just `bash`). For example, when you are in some specific directory switch between different shells - you will be moved to the home directory once you run bash :| Instead of ~/.bashrc it can be put in /etc/bashrc or /etc/bash.bashrc (whichever is present) if it is sourced less often
Author
Owner

@frencojobs commented on GitHub (May 3, 2020):

I edited .bashrc and added cd ~ to the end. Good enough for my needs.

In my case, this causes problems with installed packages exported in .bashrc using $HOME. For example, I exported flutter in my .bashrc like,

export PATH="$PATH:$HOME/flutter/bin"

and if I added, cd ~ to the file, the flutter command won't work.

@frencojobs commented on GitHub (May 3, 2020): > I edited `.bashrc` and added `cd ~` to the end. Good enough for my needs. In my case, this causes problems with installed packages exported in `.bashrc` using `$HOME`. For example, I exported flutter in my `.bashrc` like, ```bash export PATH="$PATH:$HOME/flutter/bin" ``` and if I added, `cd ~` to the file, the flutter command won't work.
Author
Owner

@thelazyanalyst commented on GitHub (May 24, 2020):

@DHowett-MSFT you said

since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff.

But that doesn't make sense because Terminal knows to start WSL with the correct container purely based on the UUID (I presume?), there is nothing else in the entry that says which WSL container to open, and I can actually change the name and the path. Here's my Ubuntu install, I can say it's Alpine and it will still load Ubuntu with the correct path, but I can't say //wsl/$/Whatever so it needs to be the name of an existing install:

      {
        "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
        "hidden": false,
        "name": "Whatever",
        "startingDirectory": "//wsl$/Alpine/home/wmertens/",
        "source": "Windows.Terminal.Wsl"
      }

This fixed my issue. Thank you.

@thelazyanalyst commented on GitHub (May 24, 2020): > > > @DHowett-MSFT you said > > > since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff. > > But that doesn't make sense because Terminal knows to start WSL with the correct container purely based on the UUID (I presume?), there is nothing else in the entry that says which WSL container to open, and I can actually change the name and the path. Here's my Ubuntu install, I can say it's Alpine and it will still load Ubuntu with the correct path, but I can't say `//wsl/$/Whatever` so it needs to be the name of an existing install: > > ```json > { > "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", > "hidden": false, > "name": "Whatever", > "startingDirectory": "//wsl$/Alpine/home/wmertens/", > "source": "Windows.Terminal.Wsl" > } > ``` This fixed my issue. Thank you.
Author
Owner

@udithaMee commented on GitHub (Jul 3, 2020):

For Ubuntu 20.04 WSL2 In the terminal settings JSON file add "startingDirectory": "//wsl$/Ubuntu-20.04/home/Your Ubuntu Username"
{
"guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
"hidden": false,
"name": "Ubuntu-20.04",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu-20.04/home/Your Ubuntu Username"
}

@udithaMee commented on GitHub (Jul 3, 2020): For Ubuntu 20.04 WSL2 In the terminal settings JSON file add "startingDirectory": "//wsl$/Ubuntu-20.04/home/Your Ubuntu Username" { "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", "hidden": false, "name": "Ubuntu-20.04", "source": "Windows.Terminal.Wsl", "startingDirectory": "//wsl$/Ubuntu-20.04/home/Your Ubuntu Username" }
Author
Owner

@dgp1130 commented on GitHub (Jul 15, 2020):

Just to point out a mistake I made that I haven't seen posted here, I renamed my distro from Ubuntu-20.04 to Ubuntu. So I presumed the path would also be just Ubuntu. I tried:

//wsl$/Ubuntu/home/<username>

But this did not work. Instead I still needed to include the version number:

//wsl$/Ubuntu-20.04/home/<username>

The second "directory" in the path is apparently not the name of your distro. I'm not entirely sure where it comes from, but it seems I still had the default value from the install.

@dgp1130 commented on GitHub (Jul 15, 2020): Just to point out a mistake I made that I haven't seen posted here, I renamed my distro from `Ubuntu-20.04` to `Ubuntu`. So I presumed the path would also be just `Ubuntu`. I tried: ``` //wsl$/Ubuntu/home/<username> ``` But this did not work. Instead I still needed to include the version number: ``` //wsl$/Ubuntu-20.04/home/<username> ``` The second "directory" in the path is apparently **not** the name of your distro. I'm not entirely sure where it comes from, but it seems I still had the default value from the install.
Author
Owner

@rkdfx commented on GitHub (Jul 15, 2020):

Just to point out a mistake I made that I haven't seen posted here, I renamed my distro from Ubuntu-20.04 to Ubuntu. So I presumed the path would also be just Ubuntu. I tried:

//wsl$/Ubuntu/home/<username>

But this did not work. Instead I still needed to include the version number:

//wsl$/Ubuntu-20.04/home/<username>

The second "directory" in the path is apparently not the name of your distro. I'm not entirely sure where it comes from, but it seems I still had the default value from the install.

Yes, this worked. I've included version name and now it's working fine.

@rkdfx commented on GitHub (Jul 15, 2020): > > > Just to point out a mistake I made that I haven't seen posted here, I renamed my distro from `Ubuntu-20.04` to `Ubuntu`. So I presumed the path would also be just `Ubuntu`. I tried: > > ``` > //wsl$/Ubuntu/home/<username> > ``` > > But this did not work. Instead I still needed to include the version number: > > ``` > //wsl$/Ubuntu-20.04/home/<username> > ``` > > The second "directory" in the path is apparently **not** the name of your distro. I'm not entirely sure where it comes from, but it seems I still had the default value from the install. Yes, this worked. I've included version name and now it's working fine.
Author
Owner

@DHowett commented on GitHub (Jul 15, 2020):

Oh gosh, that’s a really big gotcha. Thanks for pointing that out.

Yeah, the distro name is the system’s name for it; whichever one comes out of wsl.exe -l

@DHowett commented on GitHub (Jul 15, 2020): Oh gosh, that’s a really big gotcha. Thanks for pointing that out. Yeah, the distro name is the system’s name for it; whichever one comes out of `wsl.exe -l`
Author
Owner

@amaria commented on GitHub (Jul 20, 2020):

Also, if you have mapped a network drive to \wsl$ use the drive name/letter. Otherwise none of these suggestions will work.

@amaria commented on GitHub (Jul 20, 2020): Also, if you have mapped a network drive to \\wsl$ use the drive name/letter. Otherwise none of these suggestions will work.
Author
Owner

@kvietmeier commented on GitHub (Jul 20, 2020):

I have tried all of those and still getting Windows home directory.
{ //WSL "guid": "{69b4a9a7-42eb-457e-b4eb-9c6bef28aa4d}", "hidden": false, "name": "Ubuntu", "source": "Windows.Terminal.Wsl", "colorScheme" : "One Half Dark", "startingDirectory": "//wsl$/Ubuntu/home/karlv" },
WSL 2.0 with Ubuntu 20.04 installed from the Windows Store. Could it be the GUID?

karlv@MININT-J0FCRPR:/mnt/c/Users/kavietme$

@kvietmeier commented on GitHub (Jul 20, 2020): I have tried all of those and still getting Windows home directory. ` { //WSL "guid": "{69b4a9a7-42eb-457e-b4eb-9c6bef28aa4d}", "hidden": false, "name": "Ubuntu", "source": "Windows.Terminal.Wsl", "colorScheme" : "One Half Dark", "startingDirectory": "//wsl$/Ubuntu/home/karlv" }, ` WSL 2.0 with Ubuntu 20.04 installed from the Windows Store. Could it be the GUID? `karlv@MININT-J0FCRPR:/mnt/c/Users/kavietme$`
Author
Owner

@DHowett commented on GitHub (Jul 20, 2020):

I'm guessing that if you run wsl -l, your distribution isn't named Ubuntu or Ubuntu-20.04?

@DHowett commented on GitHub (Jul 20, 2020): I'm guessing that if you run `wsl -l`, your distribution isn't named `Ubuntu` or `Ubuntu-20.04`?
Author
Owner

@cuttleman commented on GitHub (Jul 22, 2020):

"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\<username>"
It's working on my WSL2 Ubuntu 20.04 LTS

@cuttleman commented on GitHub (Jul 22, 2020): `"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\<username>"` It's working on my WSL2 Ubuntu 20.04 LTS
Author
Owner

@jcgoble3 commented on GitHub (Jul 22, 2020):

"startingDirectory": "//wsl$/Ubuntu/home/<username>", is what worked for me (Ubuntu 20.04). This was driving me crazy because I open and close the terminal frequently, but with WSL 2 on Windows 20H2 beta, merely loading the prompt in a mounted Windows filesystem takes over a minute, but I work exclusively in the Linux filesystem, so I was constantly having to wait for the prompt to load just so I could cd to my Linux home directory.

@jcgoble3 commented on GitHub (Jul 22, 2020): `"startingDirectory": "//wsl$/Ubuntu/home/<username>",` is what worked for me (Ubuntu 20.04). This was driving me crazy because I open and close the terminal frequently, but with WSL 2 on Windows 20H2 beta, merely loading the prompt in a mounted Windows filesystem takes over a minute, but I work exclusively in the Linux filesystem, so I was constantly having to wait for the prompt to load just so I could `cd` to my Linux home directory.
Author
Owner

@Slingx commented on GitHub (Aug 14, 2020):

//wsl$/Ubuntu-20.04/home/Your Ubuntu Username

this worked!!!! tysm. Mine was ubuntu 18.04 btw

@Slingx commented on GitHub (Aug 14, 2020): > //wsl$/Ubuntu-20.04/home/Your Ubuntu Username this worked!!!! tysm. Mine was ubuntu 18.04 btw
Author
Owner

@herbert256 commented on GitHub (Sep 11, 2020):

late to the party, I did below once and after that all feature sessions are started in the linux home directory instead of the windows home directory

echo "cd ~" >> ~/.profile

@herbert256 commented on GitHub (Sep 11, 2020): late to the party, I did below once and after that all feature sessions are started in the linux home directory instead of the windows home directory echo "cd ~" >> ~/.profile
Author
Owner

@mcandre commented on GitHub (Oct 23, 2020):

Some blogs provide incorrect instructions, such as adding an Ubuntu version prefix. Combined with Windows Terminal silently failing in the event that such a path is invalid.

@mcandre commented on GitHub (Oct 23, 2020): Some blogs provide incorrect instructions, such as adding an Ubuntu version prefix. Combined with Windows Terminal silently failing in the event that such a path is invalid.
Author
Owner

@ad-on-is commented on GitHub (Nov 1, 2020):

If you're using the new --mount option and have symlinked your user-directory to that mount, you need something like this: "startingDirectory" : "//wsl$/<distro>/mnt/wsl/PHYSICALDRIVE<x>p<x>/<folder>"

@ad-on-is commented on GitHub (Nov 1, 2020): If you're using the new `--mount` option and have symlinked your user-directory to that mount, you need something like this: `"startingDirectory" : "//wsl$/<distro>/mnt/wsl/PHYSICALDRIVE<x>p<x>/<folder>"`
Author
Owner

@thehaystacker commented on GitHub (Nov 16, 2020):

You have to set this in the profile list object

"profiles":
{
    "defaults":
    {
        // Put settings here that you want to apply to all profiles.
    },
    "list":
    [
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl",
            "startingDirectory": "D:\\projects"
        }
    ]
}
@thehaystacker commented on GitHub (Nov 16, 2020): You have to set this in the profile list object "profiles": { "defaults": { // Put settings here that you want to apply to all profiles. }, "list": [ { "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}", "hidden": false, "name": "Ubuntu-18.04", "source": "Windows.Terminal.Wsl", "startingDirectory": "D:\\projects" } ] }
Author
Owner

@arsaccol commented on GitHub (Jan 15, 2021):

non-escaped also works:

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

This worked for me. If I may ask, what kind of syntax is that for the path? With the "wsl" and dollar sign starting it. Is there some name for it? It reminds me of how URIs start with a protocol such as <protocol>://address.something and so on

@arsaccol commented on GitHub (Jan 15, 2021): > non-escaped also works: > > ```json > "startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>" > ``` This worked for me. If I may ask, what kind of syntax is that for the path? With the "wsl" and dollar sign starting it. Is there some name for it? It reminds me of how URIs start with a protocol such as `<protocol>://address.something` and so on
Author
Owner

@jcgoble3 commented on GitHub (Jan 15, 2021):

The path beginning with // is how Windows indicates a reference to another system, with the first path element being the name of that system. The system can be a network server, LAN share, or in this case, WSL. The dollar sign isn't special in the syntax, but just happens to be how the WSL system is named for the path purposes (probably done to prevent collisions with any existing systems that might be named wsl.

@jcgoble3 commented on GitHub (Jan 15, 2021): The path beginning with `//` is how Windows indicates a reference to another system, with the first path element being the name of that system. The system can be a network server, LAN share, or in this case, WSL. The dollar sign isn't special in the syntax, but just happens to be how the WSL system is named for the path purposes (probably done to prevent collisions with any existing systems that might be named `wsl`.
Author
Owner

@bitcrazed commented on GitHub (Jan 15, 2021):

@lalilulelost The path you're referring to is a fully qualified UNC (Universal Naming Convention) path. More info here: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

@bitcrazed commented on GitHub (Jan 15, 2021): @lalilulelost The path you're referring to is a fully qualified UNC (Universal Naming Convention) path. More info here: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Author
Owner

@kmgrime commented on GitHub (Jan 22, 2021):

I think some of the issues people are having is confusing windows username with linux username which you see in the linuxuser@ubuntu:/mnt/c/Users/windowsUserName$ - in order to get the startingDirectory to work you have to use your distros username and not the windows one.

"startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\linuxUser",

@kmgrime commented on GitHub (Jan 22, 2021): I think some of the issues people are having is confusing windows username with linux username which you see in the linuxuser@ubuntu:/mnt/c/Users/windowsUserName$ - in order to get the startingDirectory to work you have to use your distros username and not the windows one. `"startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\linuxUser",`
Author
Owner

@fschuetz04 commented on GitHub (Mar 4, 2021):

To get the full correct path, simply open a WSL session, go to your future starting directory (e.g. cd ~), and type wslpath -w . to translate the current WSL path to a Windows one. To put it in the configuration, each \ has to be escaped with another \ or be replaced with a /.

Example output of wslpath -w .: \\wsl$\Ubuntu-20.04\home\bob
In the configuration file: "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\bob"
Or: "startingDirectory": "//wsl$/Ubuntu-20.04/home/bob"

@fschuetz04 commented on GitHub (Mar 4, 2021): To get the full correct path, simply open a WSL session, go to your future starting directory (e.g. `cd ~`), and type `wslpath -w .` to translate the current WSL path to a Windows one. To put it in the configuration, each `\` has to be escaped with another `\` or be replaced with a `/`. Example output of `wslpath -w .`: `\\wsl$\Ubuntu-20.04\home\bob` In the configuration file: `"startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\bob"` Or: `"startingDirectory": "//wsl$/Ubuntu-20.04/home/bob"`
Author
Owner

@visma-henriklarsen commented on GitHub (Mar 27, 2021):

You have to set this in the profile list object

"profiles":
{
    "defaults":
    {
        // Put settings here that you want to apply to all profiles.
    },
    "list":
    [
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl",
            "startingDirectory": "D:\\projects"
        }
    ]
}

In my case I had to use forward slashes in StartingDirectory, like:
"startingDirectory": "D://projects"

@visma-henriklarsen commented on GitHub (Mar 27, 2021): > You have to set this in the profile list object > > ``` > "profiles": > { > "defaults": > { > // Put settings here that you want to apply to all profiles. > }, > "list": > [ > { > "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}", > "hidden": false, > "name": "Ubuntu-18.04", > "source": "Windows.Terminal.Wsl", > "startingDirectory": "D:\\projects" > } > ] > } > ``` In my case I had to use forward slashes in StartingDirectory, like: "startingDirectory": "D://projects"
Author
Owner

@mrzlanx532 commented on GitHub (Mar 28, 2021):

If the methods above don't work (like for me), do this:
Add to the end .bashrc file: cd ~.

From Windows environment:

  1. execute wsl
  2. execute cd ~ && echo 'cd ~' >> .bashrc
@mrzlanx532 commented on GitHub (Mar 28, 2021): If the methods above don't work (like for me), do this: Add to the end `.bashrc` file: `cd ~`. From Windows environment: 1. execute `wsl` 2. execute `cd ~ && echo 'cd ~' >> .bashrc`
Author
Owner

@ednl commented on GitHub (Jul 2, 2021):

Reading every message here FINALLY gave me the hint https://github.com/microsoft/terminal/issues/2743#issuecomment-593103843 why it wasn't working for me: the home directory needs to have read/execute access for group/others. Strange, because the root user should have access anyway, right?

I always do chmod -R go-rwx ~ and that bit me here. It is now fixed after chmod go+rx ~ and WSL starts up in my Linux home directory again.

Another gotcha for the docs, @DHowett ?

Edit: NOPE. It seemed to have been fixed when I tried closing and reopening Windows Terminal, but when running Terminal at system boot or after a long delay between closing and reopening, it STILL starts up in /mnt/c/Users/ instead of ~. In Settings it does still say, and always has: //wsl$/Ubuntu-20.04/home/

Edit2: I found a comment https://github.com/microsoft/terminal/issues/592#issuecomment-629223710 that says the "//wsl$/ folder is not initialized until a wsl instance is started. So the first instance wont start in ~, but the others will start in ~ because the first instance initialized the //wsl$/ folder". So there is no way to always (even the first time) start up a WSL instance in the Linux home directory??

@ednl commented on GitHub (Jul 2, 2021): Reading every message here FINALLY gave me the hint https://github.com/microsoft/terminal/issues/2743#issuecomment-593103843 why it wasn't working for me: the home directory needs to have read/execute access for group/others. Strange, because the root user should have access anyway, right? I always do ```chmod -R go-rwx ~``` and that bit me here. It is now fixed after ```chmod go+rx ~``` and WSL starts up in my Linux home directory again. Another gotcha for the docs, @DHowett ? Edit: NOPE. It seemed to have been fixed when I tried closing and reopening Windows Terminal, but when running Terminal at system boot or after a long delay between closing and reopening, it STILL starts up in /mnt/c/Users/<user> instead of ~. In Settings it does still say, and always has: //wsl$/Ubuntu-20.04/home/<user> Edit2: I found a comment https://github.com/microsoft/terminal/issues/592#issuecomment-629223710 that says the "//wsl$/ folder is not initialized until a wsl instance is started. So the first instance wont start in ~, but the others will start in ~ because the first instance initialized the //wsl$/ folder". So there is no way to always (even the first time) start up a WSL instance in the Linux home directory??
Author
Owner

@SGarcia710 commented on GitHub (Jul 23, 2021):

The problem isn't the documentation, it's the default JSON provided. That's why everyone keeps complaining about the same thing. Here's mine:

        "startingDirectory" : "\\\\wsl$\\Debian\\home\\<linuxuser>"

which instead takes me to /mnt/c/Users/<windowsuser>. So it looks like that string is entirely ignored and a default that has nothing to do with it is picked. It's not even the same username.

This one worked for me, just editing the JSON file

@SGarcia710 commented on GitHub (Jul 23, 2021): > The problem isn't the documentation, it's the default JSON provided. That's why everyone keeps complaining about the same thing. Here's mine: > > ``` > "startingDirectory" : "\\\\wsl$\\Debian\\home\\<linuxuser>" > ``` > > which instead takes me to `/mnt/c/Users/<windowsuser>`. So it looks like that string is entirely ignored and a default that has nothing to do with it is picked. It's not even the same username. This one worked for me, just editing the JSON file
Author
Owner

@ajfpay commented on GitHub (Aug 6, 2021):

non-escaped also works:

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

Yeah this work

@ajfpay commented on GitHub (Aug 6, 2021): > non-escaped also works: > > ```json > "startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>" > ``` Yeah this work
Author
Owner

@riolly commented on GitHub (Oct 19, 2021):

The newer windows terminal provides a UI for setting starting directory for each profile.
Using startingDirectory is not working anymore. (I'm not sure starting from which version).

Just go to setting > Profiles > Ubuntu-xx.xx > Starting directory.
You can paste the path there or just click browse and go to the directory you want.

Hope it help.

@riolly commented on GitHub (Oct 19, 2021): The **newer windows terminal** provides a UI for setting starting directory for each profile. Using `startingDirectory ` is not working anymore. (I'm not sure starting from which version). Just go to setting > Profiles > Ubuntu-xx.xx > Starting directory. You can paste the path there or just click browse and go to the directory you want. Hope it help.
Author
Owner

@riolly commented on GitHub (Oct 19, 2021):

In my case, this is the starting directory.
\\wsl.localhost\Ubuntu-20.04\home\alberto

@riolly commented on GitHub (Oct 19, 2021): In my case, this is the starting directory. `\\wsl.localhost\Ubuntu-20.04\home\alberto`
Author
Owner

@pedershk commented on GitHub (Oct 22, 2021):

In my case, this is the starting directory. \\wsl.localhost\Ubuntu-20.04\home\alberto

Same - and I presume it changed to the \\wsl.localhost format with WSL2?

@pedershk commented on GitHub (Oct 22, 2021): > In my case, this is the starting directory. `\\wsl.localhost\Ubuntu-20.04\home\alberto` Same - and I presume it changed to the `\\wsl.localhost` format with WSL2?
Author
Owner

@DHowett commented on GitHub (Oct 22, 2021):

The newer windows terminal provides a UI for setting starting directory for each profile.
Using startingDirectory is not working anymore. (I'm not sure starting from which version).

These are the same setting.

You may be seeing the issue described in https://github.com/microsoft/terminal/issues/11512#issuecomment-943722724 where the timing makes it seem as though whatever you did fixed something.

@DHowett commented on GitHub (Oct 22, 2021): > The newer windows terminal provides a UI for setting starting directory for each profile. > Using startingDirectory is not working anymore. (I'm not sure starting from which version). These are the same setting. You may be seeing the issue described in https://github.com/microsoft/terminal/issues/11512#issuecomment-943722724 where the timing makes it seem as though whatever you did fixed something.
Author
Owner

@gabriel8fm commented on GitHub (Oct 25, 2021):

@Boobies weirdly enough, I've used "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\[linux username]" in my config for a while now with no issue. Could there be any other setting that might be conflicting with it?

@MEXdave1997 your settings worked perfectly for me, thanks!

@gabriel8fm commented on GitHub (Oct 25, 2021): > @Boobies weirdly enough, I've used `"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\[linux username]"` in my config for a while now with no issue. Could there be any other setting that might be conflicting with it? @MEXdave1997 your settings worked perfectly for me, thanks!
Author
Owner

@dazrik commented on GitHub (Nov 23, 2021):

Adding cd in .bashrc seems to work.

@dazrik commented on GitHub (Nov 23, 2021): Adding `cd` in `.bashrc` seems to work.
Author
Owner

@yorkshire-pudding commented on GitHub (Dec 9, 2021):

non-escaped also works:

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

Yeah this work

worked for me too

@yorkshire-pudding commented on GitHub (Dec 9, 2021): > > non-escaped also works: > > ```json > > "startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>" > > ``` > > Yeah this work worked for me too
Author
Owner

@jetersen commented on GitHub (Dec 31, 2021):

Today after reinstalling Ubuntu 20.04

on Windows 10 21H2 (Build 19044.1415)
I had to use

"startingDirectory": "/home/<user>"

Which is GREAT 👏

@jetersen commented on GitHub (Dec 31, 2021): Today after reinstalling Ubuntu 20.04 on Windows 10 21H2 (Build 19044.1415) I had to use ```json "startingDirectory": "/home/<user>" ``` Which is GREAT 👏
Author
Owner

@ray-x commented on GitHub (Jan 4, 2022):

__

Today after reinstalling Ubuntu 20.04

on Windows 10 21H2 (Build 19044.1415) I had to use

"startingDirectory": "/home/<user>"

Which is GREAT 👏

Thanks!
Same here, if set to //wsl$/Ubuntu/home/<user> I will start from root folder

@ray-x commented on GitHub (Jan 4, 2022): > __ > Today after reinstalling Ubuntu 20.04 > > on Windows 10 21H2 (Build 19044.1415) I had to use > > ```json > "startingDirectory": "/home/<user>" > ``` > > Which is GREAT 👏 Thanks! Same here, if set to `//wsl$/Ubuntu/home/<user>` I will start from root folder
Author
Owner

@riker09 commented on GitHub (Jan 21, 2022):

I have Windows 10 Version 20H2 - Build 19042.1415 and had to use /home/<user> where <user> needed to be replaced with the actual user name. All other solutions provided above did not work for me. I have only Ubuntu installed inside WSL.

@riker09 commented on GitHub (Jan 21, 2022): I have Windows 10 Version 20H2 - Build 19042.1415 and had to use `/home/<user>` where `<user>` needed to be replaced with the actual user name. All other solutions provided above did not work for me. I have only Ubuntu installed inside WSL.
Author
Owner

@zadjii-msft commented on GitHub (Jan 21, 2022):

Okay lemme clear this up before there's more confusion. This ISN'T something that came with a Windows update, this is a Terminal change in 1.12.

In 1.12, you should be able to use /home/<user> as the startingDirectory, and the Terminal should automatically promote that to the correct path. Unfortunately, that came at a cost - there's a bug in 1.12 where //wsl$/Ubuntu/home/<user> paths will be treated as /. That's fixed in #12102. (\\wsl$\Ubuntu\home\<user> with backslashes should still work)

@zadjii-msft commented on GitHub (Jan 21, 2022): Okay lemme clear this up before there's more confusion. This ISN'T something that came with a Windows update, this is a Terminal change in 1.12. In 1.12, you should be able to use `/home/<user>` as the `startingDirectory`, and the Terminal should automatically promote that to the correct path. Unfortunately, that came at a cost - there's a bug in 1.12 where `//wsl$/Ubuntu/home/<user>` paths will be treated as `/`. That's fixed in #12102. (`\\wsl$\Ubuntu\home\<user>` with backslashes should still work)
Author
Owner

@wolf99 commented on GitHub (Feb 2, 2022):

My work laptop just updated from 1909 to 20H2 (upgrades are controlled by policy, thus the reason for not being on a newer version or having updated sooner).
Previously the following had worked just fine to start WT in ~ : "startingDirectory" : "/wsl$/Ubuntu/home/emoltob"
After the upgrade WT started in /, I assume it was then ignoring this setting as somehow invalid.
Changing to the following solved this: "startingDirectory" : "\\\\wsl$\\Ubuntu\\home\\emoltob"

Yes, these two seem basically equivalent. Yet the latter works while the former is apparently now ignored.

@wolf99 commented on GitHub (Feb 2, 2022): My work laptop just updated from 1909 to 20H2 (upgrades are controlled by policy, thus the reason for not being on a newer version or having updated sooner). Previously the following had worked just fine to start WT in `~` : `"startingDirectory" : "/wsl$/Ubuntu/home/emoltob"` After the upgrade WT started in `/`, I assume it was then ignoring this setting as somehow invalid. Changing to the following solved this: `"startingDirectory" : "\\\\wsl$\\Ubuntu\\home\\emoltob"` Yes, these two seem basically equivalent. Yet the latter works while the former is apparently now ignored.
Author
Owner

@zadjii-msft commented on GitHub (Feb 2, 2022):

@wolf99 what you're seeing is exactly what I've described in https://github.com/microsoft/terminal/issues/2743#issuecomment-1018540758

@zadjii-msft commented on GitHub (Feb 2, 2022): @wolf99 what you're seeing is exactly what I've described in https://github.com/microsoft/terminal/issues/2743#issuecomment-1018540758
Author
Owner

@wolf99 commented on GitHub (Feb 2, 2022):

Mmm I'm not on 1.12 yet though as I do not use the pre release versions. I am still on 1.11. Are you saying this change was also present in 1.11 ?

@wolf99 commented on GitHub (Feb 2, 2022): Mmm I'm not on 1.12 yet though as I do not use the pre release versions. I am still on 1.11. Are you saying this change was also present in 1.11 ?
Author
Owner

@zadjii-msft commented on GitHub (Feb 2, 2022):

Yea, looks like we serviced #9223 to 1.11.2421 as well.

@zadjii-msft commented on GitHub (Feb 2, 2022): Yea, looks like we serviced #9223 to 1.11.2421 as well.
Author
Owner

@morph2k commented on GitHub (Feb 3, 2022):

I worked my way through this whole thread and it took me a while to realize that Windows Terminal has been updated. I added the line to the Json file and it only half worked, changing the starting directory from my Windows user folder to root.

Going into the settings under Ubuntu and setting the Starting directory option to \wsl$\Ubuntu\home\username\ works but not when using /

@morph2k commented on GitHub (Feb 3, 2022): I worked my way through this whole thread and it took me a while to realize that Windows Terminal has been updated. I added the line to the Json file and it only half worked, changing the starting directory from my Windows user folder to root. Going into the settings under Ubuntu and setting the Starting directory option to \\wsl$\Ubuntu\home\username\ works but not when using /
Author
Owner

@AnimeshRy commented on GitHub (Feb 8, 2022):

__

Today after reinstalling Ubuntu 20.04
on Windows 10 21H2 (Build 19044.1415) I had to use

"startingDirectory": "/home/<user>"

Which is GREAT 👏

Thanks! Same here, if set to //wsl$/Ubuntu/home/<user> I will start from root folder

This worked finally!

@AnimeshRy commented on GitHub (Feb 8, 2022): > > > > __ > > > Today after reinstalling Ubuntu 20.04 > > on Windows 10 21H2 (Build 19044.1415) I had to use > > ```json > > "startingDirectory": "/home/<user>" > > ``` > > > > > > > > > > > > > > > > > > > > > > > > Which is GREAT 👏 > > Thanks! Same here, if set to `//wsl$/Ubuntu/home/<user>` I will start from root folder This worked finally!
Author
Owner

@mcandre commented on GitHub (Feb 21, 2022):

Something recently changed and now WSL starts with a WSL root working directory instead of the correct WSL HOME working directory.

@mcandre commented on GitHub (Feb 21, 2022): Something recently changed and now WSL starts with a WSL root working directory instead of the correct WSL HOME working directory.
Author
Owner

@barcellos-pedro commented on GitHub (Mar 9, 2022):

__

Today after reinstalling Ubuntu 20.04
on Windows 10 21H2 (Build 19044.1415) I had to use

"startingDirectory": "/home/<user>"

Which is GREAT 👏

Thanks! Same here, if set to //wsl$/Ubuntu/home/<user> I will start from root folder

This worked finally!

That worked for me! Thanks! 💖

@barcellos-pedro commented on GitHub (Mar 9, 2022): > > > > > > > > > __ > > > Today after reinstalling Ubuntu 20.04 > > > on Windows 10 21H2 (Build 19044.1415) I had to use > > > ```json > > > "startingDirectory": "/home/<user>" > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Which is GREAT 👏 > > > > > > Thanks! Same here, if set to `//wsl$/Ubuntu/home/<user>` I will start from root folder > > This worked finally! That worked for me! Thanks! 💖
Author
Owner

@mbowolick commented on GitHub (Mar 13, 2022):

A lot of the paths here didn't work for me. \\wsl$\Ubuntu\home\<user> worked for me where <user> is the name of your Linux user.

@mbowolick commented on GitHub (Mar 13, 2022): A lot of the paths here didn't work for me. `\\wsl$\Ubuntu\home\<user>` worked for me where `<user>` is the name of your Linux user.
Author
Owner

@cjens00 commented on GitHub (Apr 23, 2022):

If the methods above don't work (like for me), do this: Add to the end .bashrc file: cd ~.

From Windows environment:

  1. execute wsl
  2. execute cd ~ && echo 'cd ~' >> .bashrc

Thank you. This is what I was looking for (works well enough).

@cjens00 commented on GitHub (Apr 23, 2022): > If the methods above don't work (like for me), do this: Add to the end `.bashrc` file: `cd ~`. > > From Windows environment: > > 1. execute `wsl` > 2. execute `cd ~ && echo 'cd ~' >> .bashrc` Thank you. This is what I was looking for (works well enough).
Author
Owner

@kwint commented on GitHub (Nov 25, 2022):

I still can't get this to work as expected. I want the default folder to be ~/code. So my starting dir is set to: \\wsl$\Ubuntu-22.04\home\kwint\code but this just opens the home folder and not the code folder.

Afaik I don't have any cd ~ in my .bashrc or equivalent

Edit: always after you asked for help on the internet you find the solution yourself. For some reason my default wsl profile would use the executable ubuntu2204.exe. I changed this C:\Windows\system32\wsl.exe -d Ubuntu-22.04 and now the starting directory works as expected

@kwint commented on GitHub (Nov 25, 2022): I still can't get this to work as expected. I want the default folder to be `~/code`. So my starting dir is set to: `\\wsl$\Ubuntu-22.04\home\kwint\code` but this just opens the home folder and not the code folder. Afaik I don't have any cd ~ in my .bashrc or equivalent Edit: always after you asked for help on the internet you find the solution yourself. For some reason my default wsl profile would use the executable `ubuntu2204.exe`. I changed this `C:\Windows\system32\wsl.exe -d Ubuntu-22.04` and now the starting directory works as expected
Author
Owner

@Easy-Cloud-in commented on GitHub (May 17, 2023):

This is what I did in windows 10 latest terminal settings - PowerShell 7.3.4

{
                "colorScheme": "Ubuntu-22.04-ColorScheme",
                "commandline": "wsl.exe -d ubuntu",
                "font": 
                {
                    "face": "CaskaydiaCove Nerd Font"
                },
                "guid": "{51855cb2-8cce-5362-8f54-464b92b32386}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc",
                "startingDirectory": null
 }

It worked like a charm both on right click menu and direct from terminal.

@Easy-Cloud-in commented on GitHub (May 17, 2023): This is what I did in windows 10 latest terminal settings - PowerShell 7.3.4 ``` { "colorScheme": "Ubuntu-22.04-ColorScheme", "commandline": "wsl.exe -d ubuntu", "font": { "face": "CaskaydiaCove Nerd Font" }, "guid": "{51855cb2-8cce-5362-8f54-464b92b32386}", "hidden": false, "name": "Ubuntu", "source": "CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc", "startingDirectory": null } ``` It worked like a charm both on right click menu and direct from terminal.
Author
Owner

@Nick-Hope commented on GitHub (Dec 26, 2023):

non-escaped also works:

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

//wsl$/Ubuntu/home/<user> worked for me but I also had to change my Command line in the settings from ubuntu.exe to wsl.exe -d Ubuntu.

@Nick-Hope commented on GitHub (Dec 26, 2023): > non-escaped also works: > > ```json > "startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>" > ``` `//wsl$/Ubuntu/home/<user>` worked for me but I also had to change my Command line in the settings from `ubuntu.exe` to `wsl.exe -d Ubuntu`.
Author
Owner

@kevgilmore commented on GitHub (Jan 9, 2024):

Today after reinstalling Ubuntu 20.04

on Windows 10 21H2 (Build 19044.1415) I had to use

"startingDirectory": "/home/<user>"

Which is GREAT 👏

this gave me error

[error 2147942667 (0x8007010b) when launching `ubuntu.exe']
Could not access starting directory "/home/kev/code"

Nor do any of the above strings works

@kevgilmore commented on GitHub (Jan 9, 2024): > Today after reinstalling Ubuntu 20.04 > > on Windows 10 21H2 (Build 19044.1415) I had to use > > ```json > "startingDirectory": "/home/<user>" > ``` > > Which is GREAT 👏 this gave me error ``` [error 2147942667 (0x8007010b) when launching `ubuntu.exe'] Could not access starting directory "/home/kev/code" ``` Nor do any of the above strings works
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3855