Page 1 of 1

"find" command not finding [SOLVED]

Posted: Sun Mar 31, 2013 3:05 am
by Catchpole
I don't know if I'm in the right place for this question.
I'll re-post if some one tells me a better place.

I was using the find command to find a missing iso file but it was not picked up.
The first command I used was:

Code: Select all

 ~ $ find / -iname *.iso 2>/dev/null
/home/richard/precise-5.4.2.iso 
This found one iso but not the one I was looking for.
So I put an "i" in front of the search term (i*.iso) because I knew it began with "install"

Code: Select all

 ~ $ find / -iname i*.iso 2>/dev/null
/home/richard/dvdiso/install-x86-minimal-20121213.iso
richard@Tower-Case ~ $ 
Can some one tell me why was it not picked up with the first try?

Thanks in advance for any information.

Re: "find" command not finding

Posted: Sun Mar 31, 2013 7:33 am
by catweazel

Code: Select all

man find
[...]
-iname pattern
Like -name, but the match is case insensitive.  For example, the patterns 'fo*' and 'F??' match the file names  'Foo', 'FOO', 'foo', 'fOo', etc.   In these patterns, unlike filename expansion by the shell, an initial '.' can be matched by '*'. That is, find -name *bar will match the file '.foobar'.   Please note that you should quote patterns as a matter  of  course,  otherwisethe shell will expand any wildcard characters in them.
[...]
Fancy that. It's in the manual.
Old Timer (1948 model)
Ha. Spring chicken. I've got 20 years on you, son.

Re: "find" command not finding [SOLVED]

Posted: Sun Mar 31, 2013 8:55 am
by Catchpole
Hi catweazel,

I'd read the manual a number of times in trying to solve the problem.
However I thought that if its clear to you in the manual then I'd better read it again. (Paying more attention)

Sure enough its there.
I used single quotes around the filemane pattern ( '*.iso' ) and they all popped out.

Thanks for the benefit of your twenty years seniority.

Catchpole.

Re: "find" command not finding [SOLVED]

Posted: Sun Mar 31, 2013 5:54 pm
by catweazel
Cheers, son.