Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use WSL as default terminal in WebStorm or any other JetBrains' products?

I am currently using Windows 10 with WSL Ubuntu 18.04 installed. I am trying to use WSL as the default terminal in WebStorm however, I am able to use the bash from WSL but the default directory would not be set to the default project location.

Does anyone know how to set this up correctly?

like image 469
forkadam Avatar asked Aug 18 '18 21:08

forkadam


People also ask

How do I use WSL in Webstorm?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | Node. js. , and then select Add WSL from the list. In the Add WSL Node Interpreter dialog that opens, select the Linux distribution you're using and specify the path to Node.

How do I use WSL terminal?

From the WSL terminalOpen a WSL terminal window (using the start menu item or by typing wsl from a command prompt / PowerShell). Type code . in the terminal. When doing this for the first time, you should see VS Code fetching components needed to run in WSL.

How do I start IntelliJ from WSL?

In IntelliJ IDEA, you can directly open a project stored in the WSL file system and work with it like with any other project. Click Open on the Welcome screen or select File | Open from the main menu.

Where is WSL exe located?

wsl.exe and bash.exe live in \Windows\System32 . 64 bit applications have that path mapped into their path on where to look for files. However, 32 bit applications do not look in System32 for files - they look in the SysWow64 folder.


2 Answers

After a bit of search on google found a solution to my question.

First figure out the default wsl with the command:

C:\Windows\System32\wslconfig /list  Windows Subsystem for Linux Distributions: Ubuntu-18.04  Legacy (Default) 

then I set the default to Ubuntu-18.04 by

C:\Windows\System32\wslconfig /setdefault Ubuntu-18.04 

Finally set the terminal path in Webstrom settings>tools>terminal to

C:\Windows\System32\wsl.exe 

Now open the terminal it is correctly move the current directory to the /mnt/c/blah/blah

like image 103
forkadam Avatar answered Sep 17 '22 16:09

forkadam


Set:
Settings > Tools > Terminal > Shell path

Equal to:

"C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\ubuntu.exe" run 

change setting


The result is:

resulting terminal

like image 23
NonlinearFruit Avatar answered Sep 16 '22 16:09

NonlinearFruit