Replace PHPStorm terminal with WSL on Windows

In my previous article, I wrote about how to replace the default terminal with Git Bash. It’s easy and at the same time a simple way to get access to some useful commands from Linux in your Windows machine.

While this works great, using the Windows WSL is even better because it basically works like a real Linux machine.

Note: This article is dedicated to the PHPStorm editor, but the rule applies to any IntelliJ IDE.

Step 1:

Ope Open PHPStorm settings from File->Settings, go to Tools->Terminal, and update the “Shell Path” with the following value:

C:\Windows\System32\wsl.exe

Make sure that the path to your Windows installation is the same as mine.

Tested with both WSL1 and WSL2.

Step 2:

It’s worth noting that in step 1 we set up it only for the Current Project. But what happens when we create new projects? The cmd.exe from Windows 10 is back. Thus we must add the settings for new projects also.

Go to File -> New Projects Settings -> Settings For New Projects…, then under Tools->Terminal update the “Shell Path” with the following value, which is exactly like in Step 1:

C:\Windows\System32\wsl.exe

Note: You must close the current Terminal and re-open it to make these changes visible.

Last note: This article assumes that you already have a Linux distribution installed with your WSL. For more info check this one that I use: https://ubuntu.com/wsl

Member since January 2, 2019

As a seasoned WordPress developer with expertise in various tech stacks and languages, I bring years of experience to every project I handle. My passion for coding and dedication to delivering exceptional work ensures that each project I take on is of the highest quality. I specialize in creating custom themes, developing plugins, and building full-scale web systems. By staying up-to-date with the latest industry trends and best practices, I incorporate cutting-edge solutions into my work.

Comments

Your email address will not be published. Required fields are marked *