2

I installed the WSL Bash on Windows 10 so it can act as my terminal in VScode, but the default directory is ~/home/USERNAME

I would like it to be /mnt/c/Users/USERNAME (so on my windows domain side)

I've looked at so many different angles on how to change the default from adding a command to .bashrc that manually changes the directory on startup, to going to the registry editor and trying to change the default directory for CMD, (turns out even that's a challenge as the file I needed to alter doesn't even exist but that's a problem for another day)

Any ideas on how I can change the WSL ubuntu18.04 terminal so that the default directory on startup is different?

5
  • 1
    This may do what you need 👍🏻
    – matigo
    Oct 28, 2021 at 4:50
  • Annoyingly enough, this is exactly what the Terminal app does for me if I don't set a starting directory (leaving me in /mnt/c/Users/USERNAME)
    – muru
    Oct 28, 2021 at 4:52
  • @muru How do you set a starting directory?
    – ZaneK
    Oct 28, 2021 at 13:49
  • @matigo Sorry, it seems that changing .bashrc DOES make a different for the regular Ubuntu terminal but perhaps NOT for the WSL ubuntu terminal on windows 10 which is what a require it for. (it ignores my additions to the bashrc file, I try cd .. and it does nothing)
    – ZaneK
    Oct 28, 2021 at 14:02
  • @ZaneK I was talking about the new Windows Terminal app which has an option to set the starting directory for each profile.
    – muru
    Oct 29, 2021 at 5:17

1 Answer 1

0

All of this is done in VS Code.

First, make sure to install the Remote - WSL VS Code extension.

Open user preferences: File -> Preferences -> Settings

In "Search settings" type cwd

In the block labeled Terminal > Integrated: Cwd enter /mnt/c/Users/[your windows user name]

Close settings and reopen the terminal and the starting directory should now be your windows user directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.