Pretending WSL commands are native to Powershell

Today I have solved one of the biggest frustrations in Windows - no availability of Linux commands. If you are on Windows, WSL is a life saver, but that only works from inside the WSL bash console (am I calling it right?) so you would have to open another console, map windows mount to the correct path, and that might or might not work. Pretty tedious.

Another solution is prepending every command with wsl i.e. to call grep from powershell, you would write wsl grep... etc. This is better but still sucks when you forget you are in windows.


So today I found a perfect solution - there is a powershell module called WSL Interop that makes powershell pretend the commands are available on windows.

Quick Start

If you don’t want to read the whole manual, installation is actually pretty simple:

Install-Module WslInterop

That does it.

Then to make a command available in powershell:

Import-WslCommand grep

That does it:


To persist those, just add a set of Import-WslCommand to your powershell profile!

The original really awesome article I stumbled upon is here.

To contact me, send an email anytime or leave a comment below.