I need to perform a search for "foo" and return all the filenames/directories with this name (e.g. foo.php
, foo.txt
etc). It should run through the whole filesystem and find even hidden files.
I've tried find / -name 'foo'
but doesn't seem to work.
Centos – how to find a filename with all the possible extensions
findregex
Best Answer
find
's-name
operator uses shell-style wildcards, sowould find foo.php foo.txt or hidden files like .foo.php etc.
-o
means "Or", without it a file would have to have both names. Use-iname
if you want case insensitive matching.