I'm still learning the command line and I am having some trouble fully understanding the use of the wildcard within the find command.
I'm working in the directory user/temp and use the find command as followed to find all .txt files:
find . -name *.txt -print
This gives me the error:
find: unknown primary or operator.
I know you need to use single quotes around the *.txt
in order to escape the expansion and get your desired result; however, I do not understand why this needs to be done.
I read that you have to escape the *
so that find
does the expansion internally. I am confused because I thought that using single quotes around *
will give make the command line not interpret it as a special character, so how does the expansion take place?
*
into the first find command, if you didn't mean that to be there obviously remove it – Eric Renouf Oct 30 '15 at 17:30