Reputation: 393
I have Ubuntu installed on Windows 10 with WSL. In the WSL bash terminal, when I run code ~/.bashrc
it opens visual studio code to a blank file. Revealing the file in explorer shows that the path of this file is C:\home\[user]
, which is the Windows user directory, not the WSL/Ubuntu user directory.
When I run nano ~/.bashrc
or vim ~/.bashrc
, the default .bashrc file opens in nano/vim which I can edit. I was able to dig around and found that the path to this file is at C:\Users\[Windows user name]\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\[WSL user name]
Why do the commands code
and nano
recognize ~/
differently? And how can I make code
point to the WSL/Ubuntu user directory?
Upvotes: 0
Views: 1744
Reputation: 1
WSL is not a VM or Container, it's just a layer on top of Windows kernel. You can find more here
If you do in WSL terminal
which nano
you get: /bin/nano or /usr/bin/vim, for vim but for
which code
/mnt/c/Program Files/Microsoft VS Code/bin/code
What I did is How to add multiple terminal in VS Code?
Upvotes: 0