The parentheses/brackets are used by find
to enforce precedence among its predicates. The comma is an operator in GNU find
that evaluates both the preceding predicate and the predicate that follows, but ignores the result of the first. In your command
find /work \( -fprint /dev/stderr \) , \( -name 'core' -exec rm {} \; \)
you have two (compound) predicates:
-fprintf /dev/stderr
-name 'core' -exec rm {} \;
The first one prints the name of the found file to standard error. The second one removes only those files whose name is core
. Without the comma, only the names of the file being removed would be written to standard output; that is, the comma overrides the implicit and
performed on multiple predicates. (The parentheses around the -fprintf
might be optional, since they are just forming a group consisting of a single predicate, but I'm not positive.)