[Cialug] Help finding file?

Don Ellis don.ellis at gmail.com
Mon Jan 2 15:54:06 CST 2012


I see your grep ignores case -- yes, that would be a bit different.

On Mon, Jan 2, 2012 at 3:53 PM, Don Ellis <don.ellis at gmail.com> wrote:
> The grep is not necessary; it can be included in the find command itself:
>
>    find / -name \*partial_name\*
>
> That last element (the -name field) accepts a number of shell pattern
> matching characters (not a regex, but good enough for most file name
> patterns).
>
> From the find man page:
>
>     -name pattern
>             True if the last component of the pathname being examined matches
>             pattern.  Special shell pattern matching characters (``['', ``]'',
>             ``*'', and ``?'') may be used as part of pattern.  These characters
>             may be matched explicitly by escaping them with a
> backslash (``\'').
>
> There are some other options visible on the man page. -exec allows
> executing a command on each item found, -ls produces a listing much
> like 'ls -l'.
>
> --Don Ellis
>
>
> On Mon, Jan 2, 2012 at 3:43 PM, kristau <kristau at gmail.com> wrote:
>> There are several ways to skin that particular cat. This is the one I use
>> most often:
>>
>> find / | grep -i <partial file name>
>>
>> On Jan 2, 2012 3:37 PM, "Tom Sellers" <tomsellers2001 at yahoo.com> wrote:
>>>
>>> What is the Ubuntu linux command to locate a file anywhere on the disk?  I
>>> need to have it search the whole directory structure not just the current
>>> directory for the file.
>>>
>>> If I use find by itself it lists all directory items but it I list the
>>> file name after the find command it only seems to search the local directory
>>> and tells me that it is not there.
>>>
>>> Surely there is a command to do this.  I just haven't been able to find
>>> it.


More information about the Cialug mailing list