Ubuntu – Windows Subsystem Linux VSCode path

bashcommand linewindows-subsystem-for-linux

I have made a mess with trying to install Visual Studio Code on my Windows Subsystem Linux.

Before I get into that I was able to use the terminal command code . to open VSCode in the current directory, this worked with cmd, bash, zsh or fish

Since trying to install VSCode on my WSL which doesn't work just yet I haven't been able to use the code . command.

So I did a whereis code then found this:

code: /usr/bin/code /usr/share/code /mnt/c/Program Files/Microsoft VS 
Code/bin/code /mnt/c/Program Files/Microsoft VS Code/bin/code.cmd

So, I'm guessing installing VSCode for Linux added in /usr/bin/code and /usr/share/code which I'm also guessing is what's being called when I do my code . command?

Then ls -la /usr/bin/ and I find this:

lrwxrwxrwx 1 root   root          24 Oct  9 19:38 code -> /usr/share/code/bin/code*

This is where I'm a bit confused now, I'd like to get it back to pointing at the /mnt/c/Program Files/Microsoft VS Code/bin/code and /mnt/c/Program Files/Microsoft VS Code/bin/code.cmd I guess but I'm a bit confused as to what to do next.

Any pointers greatly appreciated :ok_hand:

Thanks

Best Answer

You need to remove the symlinks created in /usr/bin/code and /usr/share/code.

You don't need to add new symlinks in WSL to make code run: VSCode installs a code.sh file in its folder that's accessible on your path since we append the Windows path to your Linux path in WSL.