unix find command on cmder.exe in windows
I installed cmder shell emulator for Windows.
Works fine but I can't use Unix's find command. Apparently when I type:
'find .'
in the terminal it tries to use the Windows' FIND and output this error:
FIND: Parameter format not correct
I'd really like to use find, any hint on how to get it working?
Solution 1:
Simplest solution is to create an alias to the find
executable within the cmder
installation folder:
λ which find
/c/WINDOWS/system32/find
λ find --help
FIND: FIND: Parameter format not correct
λ alias find=C:\Files\Programs\cmder\vendor\git-for-windows\usr\bin\find.exe $*
λ find --help
Usage: /usr/bin/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
May I suggest you also try out Cygwin where, among other things, find
works out of the box. That is what I used to ascertain the location of the cmder
-supplied find.exe
.
Kudos to @Bob and @AFH for their insightful comments, and to @Lưu Vĩnh Phúc for suggesting another dead-simple solution:
rename the *nix
find
to another name likefnd.exe
This might actually be preferrable over creating an alias, because cmder
aliases don't work in Windows 10 unless Use legacy console
is selected in cmd
properties (see how to do it).
Solution 2:
Cmder\vendor\git-for-windows\usr\bin
is added to the PATH by Cmder\vendor\init.bat
. Unfortunately, it's added at the end of the PATH, so Windows's find.exe is found first.
Fortunately, it's easy to fix. Just add this line inside Cmder\config\user-profile.cmd
:
set "PATH=%GIT_INSTALL_ROOT%\usr\bin;%PATH%"