I need to perform a search for "foo" and return all the filenames/directories with this name (e.g.
foo.txt etc). It should run through the whole filesystem and find even hidden files.
find / -name 'foo' but doesn't seem to work.
-name operator uses shell-style wildcards, so
find / -name 'foo.*' -o -name '.foo.*'
would 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.
use -regex option which is applied to the full path of each file / dir / socket etc tested
find / -regex '.*foo\.(php|txt|iso)'
should work for hidden files too.