"Illegal option" error when using find on macOS
22,994
The first argument to find
is the path where it should start looking. The path .
means the current directory.
find . -type f -name '*R'
You must provide at least one path, but you can actually provide as many as you want:
find ~/Documents ~/Library -type f -name '*R'
Author by
Gravity M
Updated on July 09, 2022Comments
-
Gravity M almost 2 years
I am trying to list the files only with the letter "R" at the end. I used
find
as follows in macOS Terminal,find -type f -name '*R'
But I got the message saying
illegal option --t
. -
Reinstate Monica Please over 9 yearsYou should probably specify that you're talking about
bsd find
.find -type f -name '*R'
is completely fine ingnu
. -
rob mayoff over 9 yearsI'm talking about standard POSIX
find
. -
Reinstate Monica Please over 9 yearsYes, but the reason for the confusion here is likely that
gnu find
will default to.
if you don't provide an argument. Mac OS usesbsd
by default, which requires an argument if you don't provide one to-f
. And using statements likemust provide at least one path
without specifying a version offind
is likely just going to cause more confusion. -
Cole Bittel over 8 yearsI came to this question, having the exact same confusion that @BroSlow was suggesting.