unix find command on cmder.exe in windows
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%"
Related videos on Youtube
Comments
-
Heisenbug over 1 year
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?
-
Admin almost 7 yearsYou would need to make whichever directory
find
is in appear beforeC:\Windows\System32
(where Windows' find lives) in thePATH
environment variable. This is generally considered not a great idea to do globally as it tends to confuse other programs that expect a standard Windows environment. Rather, you should see if you can set a startup script in Cmder, and make the script do something likeset PATH=C:\path\to\folder\with\unix\find;%PATH%
-
Admin almost 7 yearsI don't know
cmder
, but in Linux/Unixwhich -a find
will show all programs which could execute with the find command. Identify the Unixfind
. Then use its full path, or re-arrange the order ofPATH
directories, or set an alias, ifcmder
supports this; you could also rename the Windowsfind.exe
towfind.exe
. If it emulatesbash
, then you can use the in-builttype -a find
. -
Admin almost 7 years
-
Admin almost 7 yearsPossible duplicate of How do I rename C:\Windows\System32\convert.exe?
-
Admin almost 7 years@AFH
which -a find
returns/c/WINDOWS/system32/find /usr/bin/find
. Unfortunately, though, running/usr/bin/find
yieldsThe system cannot find the path specified.
. It seems the actual windows-style path is needed here. Runningtype
launches the windowstype
, and it appearscmder
does not provide the unix-like version. -
Admin almost 7 years@simlev - As you say, Cygwin or (if on Win10) WSL may be a better bet, though it is less easy to call native Windows programs, which may not suit the questioner.
-
Admin over 6 yearsYou may wish to move
%git_install_root%
where the newPATH
is constructed ininit.bat
, see github.com/cmderdev/cmder/issues/37
-
-
Heisenbug almost 7 yearsThanks for the suggestion. Seems the best way to go. I normally use cygwin when on windows but for working reasons I am forced to cmder right now. I will try this asap!
-
simlev almost 7 years@Heisenbug
cmder
has the obvious advantage of being portable and not needing installation to be performed by a privileged user. -
phuclv almost 7 yearsyou can also simply rename the *nix
find
to another name likefnd.exe
-
Heisenbug almost 7 yearsI renamed the unix version, to avoid modifying windows native stuff. But thanks, what I was really missing was the folder where those commands where stored and your answer helped me.
-
Admin about 6 yearsIsn't gnu find normally called gfind on non-gnu systems?
-
Cale Sweeney over 2 yearsJerem is referring to the windows find here:
C:\Windows\System32\find.exe
. In the System variables path it looks like%SystemRoot%\system32
, usually towards the top. -
Cale Sweeney over 2 yearsDon't let it confuse you that after you successfully setup your
find
alias,λ which find
still responds with/c/windows/system32/find
.λ which find
cares about your path, not your cmder alias.