Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use the + option of find exec instead of xargs. However, I can't seem to get it to work. I feel I must be missing something obvious here.


find . -name "*.java" -exec grep "@author" {} + \;
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

On the other hand, this works:

find . -name "*.java" -exec grep "@author" {}  \;

as does this:

find . -name "*.java" | xargs  grep "@author"
share|improve this question
up vote 3 down vote accepted

You don't need \; together with +

share|improve this answer
find . -name "*.java" -exec grep "@author" {} + – Dennis Williamson Sep 11 '09 at 8:45

It's much easier just to use find -print0 | xargs --null -I XXX do_something XXX. Let find to the finding and xargs do the, er, other stuff.

share|improve this answer
If you use find -print0, you need -0 for xargs. – Doug Harris Oct 8 '09 at 18:15
-0 is the short version of --null. – Ryan Thompson Oct 8 '09 at 22:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.