Search code examples
powershellterminalgrepless-unix

Why I can run less, grep and find in Windows Powershell?


A friend told me that Windows PowerShell doesn't have these Unix-style commands. Well, I tried and saw that I can in fact run these.

Now I'm wondering why is that. Could it be because I have installed NodeJs on this Windows machine?

If they are not by default usable in Windows PowerShell, is there a way to find out what exactly has brought them into use in this Windows installation?

Running Windows 8.1.


For those that are interested, based on the chosen answer, I found out that installing Git on this machine has brought those commands to use:

PS C:\Users\myusername> where.exe grep
C:\Users\myusername\AppData\Local\Programs\Git\usr\bin\grep.exe

PS C:\Users\myusername> where.exe less
C:\Users\myusername\AppData\Local\Programs\Git\usr\bin\less.exe

Solution

  • You can try this

    where.exe find
    where.exe less
    where.exe grep
    

    They'll return the path to the exe file if those tools exist on your PC. You can always run find because there's find.exe, although it's not Unix find but a tool for searching text. less and grep won't be available by default but if you have Cygwin, MSYS or Gnu32 installed then they'll be ready in path. Git on Windows runs on MSYS so unsurprisingly you can run less, grep or other Unix tools

    Note that you need to use where.exe command instead of only where command like on cmd.exe because where on powershell has a different meaning