I widely use Unix/Posix like commands in my daily activities. I have only Windows environments. For that reason I use utility called MobaXterm which is built on top of Cygwin and allow me to use utilities like awk, sed, Grep and etc. I noticed that Power shell on my PC works significantly faster than MobaXterm hence I want to use it from inside the powershell. E.g. instead of using poweshell ‘Select-String’ I want to use Cygwin’grep’ How should I do it? Could I change the path to MobaXterm bin directory to make powershell aware of it? Or something similar? Note: I do not have admin privilege on my PC Appreciate your help
Asked
Active
Viewed 145 times
0
-
1I don't understand the question. Powershell is a shell. You can call command line utilities from Powershell. You will face issues with object vs string paradigm if you mix the two (Cygwin utilities think of everything as a string of characters, Powershell cmdlets think of everything as an object) and issues with how the shell parser tokenizes arguments, but you can largely just... use the commands normally. – Bacon Bits Sep 11 '22 at 14:51
-
Cygwin programs work best (and fastest) when they are run from within a cygwin shell, like bash. I would recommend trying the MinTTY terminal with a bash shell. An alternative is the MSYS2 MINGW64 system from a Powershell or CMD or even MSYS2's bash shell in Windows Terminal. You just add the MSYS2 and MINGW64 folders to your PATH to get all the familiar Linux commands without the need to manually translate paths between windows and POSIX style. – Doug Henderson Sep 11 '22 at 17:57
-
FYI regarding executables in PS; [PowerShell- Running Executables - TechNet Articles - United States (English) - TechNet Wiki](https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx) – postanote Sep 11 '22 at 18:51
-
Folks, I realized that my issue is caused by my organization policy that prevents regular user from running any “personal “ scripts. Well I will not go this route further. Will use MobaXterm which I think was built on top of Cygwin. But the issue with performance is still there… I did the test and compared duration of Powershell ‘Select-String’ and MobaXterm ‘grep’ utilities. It was the same and very slow. Could someone suggest how I could improve performance of “grep” from MobaXterm? Note: I am searching stuff from server I.e. not local disk. Maybe there are some tricks.. – susja Sep 14 '22 at 08:22