Short: How to use VSCode on WSL2

Rodrigo Burgos - Dec 9 '24 - - Dev Community

Open bashrc

nano ~/.bashrc

Add this on the end of the file:

export PATH=$PATH:/mnt/c/Users/<YourUsername>/AppData/Local/Programs/Microsoft\ VS\ Code/bin
Enter fullscreen mode Exit fullscreen mode

Apply the changes:

source ~/.bashrc

Test the code command: Now, try running code . in the WSL2 terminal again:

code .

. . . . . . . . . . . . . . . . . . . . . . .