Re: find usage

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matt Graham via PLUG-discuss
Date:  
To: Main PLUG discussion list
CC: Matt Graham
Subject: Re: find usage
On 2022-06-27 14:30, Brian Cluff via PLUG-discuss wrote:
> On 6/27/22 11:32, Michael via PLUG-discuss wrote:
>> So I'm opening the directory I'm searching in a terminal and type:
>> find Marriage .
>> but it just gives me a listing of what is below '.' (I guess).
>> What am I doing wrong?


> find . -name Marriage
> or
> find . | grep Marriage
>
> The first one will only match fines that are exactly names
> "Marriage" while the second one will match any files with "Marriage"
> as part of the name.  Both versions in this case are care sensitive.


I basically always do "find . -name \*string\*" when I'm sure there's
something in or under . that contains the case-sensitive string string.
-iname is for when case doesn't matter. Escaping the * prevents the
shell from expanding the glob, as it would if you had any files
containing string in . , and that would confuse you and do the wrong
thing.

find, like many of the old tools, was not designed for casual users.
If you have anacron or leave the computer on all the time, and the file
you're looking for has been on the system for >= 24 hours, "locate -i
\*string\*" will find all the files matching (case insensitive) string
no matter where they are, and do so quite quickly.

--
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss