Title: RE: How Do I Find A File On The HD?

Andre Kirchner wrote:
> Jin,
>
> find works fine when you know the complete name of the
> file, but in case you want to look for a file which
> has the "host" substring in the name for example, try
>
> find / | grep host
>
> or if you even doesn't know if this substring has
> capital letters or not, try
>
> find / | grep -i host
>
> Hope it helps you,
>
> Andre
>


There is a much easier way to do this in one find command.  Find is very flexible and you don't have to wait one day for locate to update the database.  (Of course, you can always force the database update for locate, wait for that to be done, then do your locate command.)  But, try this:

find / -name '*[Hh][Oo][Ss][Tt]*' -print

This will recursively search for any file that contains the word host in the filename, in any case (initcap, all cap, all lower, etc.) and print the path and filename of all matches.

Brad Sites

Reply via email to