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:



1 Answer 1


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.

  • I removed /usr/bin/code but I couldn't remove /usr/share/code it works now though.
    – spences10
    Oct 13, 2017 at 19:16
  • Can you explain what a symlink is?
    – spences10
    Oct 13, 2017 at 19:17
  • @spences10 a sybmlink is a symbolic link. It's a special type of file in a directory that points to a file in a different directory. When you open, run or copy the symbolic link the OS opens the real file it points to instead. Oct 16, 2017 at 10:42

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.