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?