The basic syntax for
find is this:
Code:
find <start_dirs> <global_opts> <matching_opts> <actions>
Note that you should give it
directories to start from, not files (If you already know where the files are, why would you need
find?). And the use of "
*" style shell
globbing patterns will usually expand into a list of files (and/or directories)
before the command is run.
Note too that
find's
-name matching option and its relatives also use globbing patterns, which need to be escaped by quotation marks or backslashes so that the shell doesn't try to interpret them first.
Here are a couple of good links about using find:
http://mywiki.wooledge.org/UsingFind
http://www.grymoire.com/Unix/Find.html
Finally, if you don't need to search recursively, and just need to match files by names only, shell globbing will be faster and more efficient than
find. You can enable the
dotglob shell option to match hidden files, and use a simple
echo or
printf for printing, if you just want to list them.
Code:
shopt -s dotglob nullglob
printf '%s\n' /abc/xyz/.[AB]/*T /abc/xyz/C/*T
shopt -s dotglob nullglob extglob
printf '%s\n' /abc/xyz/*(.)[ABC]/*T
The second one uses bash's
extended globbing for greater brevity.