-5

Possible Duplicate:
How can I find a file whose name includes a given string, such as “abcde”?

How to find files in terminal that contains the string "foo"?

I tried the following but doesn't work.

find *foo*.*  // any character before or after "foo" of any extension.

I tried googling UNIX or bash wild card but doesn't provide me any useful result.

4
  • 1
    Are you looking for files with foo in their name, or files that contain the string foo somewhere in their contents? BTW, there are hundreds of resources on the use of find here and on the Internet. I'm pretty sure you can find your question answered (whether it's file name or file contents) if you search a bit more.
    – Mat
    Sep 19, 2012 at 9:00
  • files with "Foo" in the file name.
    – KMC
    Sep 19, 2012 at 9:02
  • 4
    I think you could have found this without any effort. find . -name '*foo*' Sep 19, 2012 at 9:09
  • Use a combination of find and grep as mentioned here wilddiary.com/find-files-containing-my-text
    – Drona
    Oct 8, 2015 at 13:46

2 Answers 2

-1

Comment from @ire_and_curses would be almost correct, but it will not find any files like Foo,fOo, ... This would be better in your case:

from find man page:
-iname pattern
     Like -name, but the match is case insensitive.

find <path> -iname '*foo*'
-3

sorry I didn't understand the question. You should try

find . -name '*foo*'

as specified above

Not the answer you're looking for? Browse other questions tagged .