"find" command not finding [SOLVED]

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
Catchpole
Level 4
Level 4
Posts: 349
Joined: Sat Dec 24, 2011 4:15 am
Location: Leeds UK

"find" command not finding [SOLVED]

Post 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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Desktop Computer:
Motherboard = Gigabyte GA-H61M-USB3V
CPU = Intel i3-3240 3.4GHz
Monitor = BENQ BL2411PT rev 00-012-AL
Mint 21.3 Virginia "Mate desktop" (64bit)
Memory = 12GB
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: "find" command not finding

Post 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.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
Catchpole
Level 4
Level 4
Posts: 349
Joined: Sat Dec 24, 2011 4:15 am
Location: Leeds UK

Re: "find" command not finding [SOLVED]

Post 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.
Desktop Computer:
Motherboard = Gigabyte GA-H61M-USB3V
CPU = Intel i3-3240 3.4GHz
Monitor = BENQ BL2411PT rev 00-012-AL
Mint 21.3 Virginia "Mate desktop" (64bit)
Memory = 12GB
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: "find" command not finding [SOLVED]

Post by catweazel »

Cheers, son.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Locked

Return to “Scripts & Bash”