According to the man find -exec option must end with ;.

The expression must be terminated by a semicolon (``;'').

But when I use find-grep in Emacs, the expression end with +. Which one should I use? Is there difference two expression?

2 Answers 2


This is from the manual for GNU find:

   -exec command ;
          Execute command; true if 0 status is returned.
          All following arguments to find are  taken  to
          be  arguments to the command until an argument
          consisting of `;'

Cut off by me. But we also have:

   -exec command {} +
          This variant of  the  -exec  action  runs  the
          specified  command  on the selected files, but
          the command line is built  by  appending  each
          selected  file name at the end; the total num‐
          ber of invocations of the command will be much
          less  than  the  number of matched files.  The
          command line is built in  much  the  same  way
          that xargs builds its command lines.

Cut off by me.

So, ; and + do different things. A short example in code to demonstrate:

$ mkdir test
$ touch test/{a,b}
$ find test -exec echo foo {} \;
foo test
foo test/a
foo test/b
$ find test -exec echo foo {} +
foo test test/a test/b

+ only generates a single invocation with all matching files given as an argument list (in practice it behaves like xargs). ; executes the command once for each matching file (the ; needs to be escaped in the shell; hence the preceding \).

Note that some versions of find lack the + option, but the GNU version is most likely installed on anything non-embedded Linux.

  • Note also the -execdir option. It acts like -exec, but it creates a separate command for separate folder. It's used when the calling command may be confused by starting in the wrong folder. You can use ; or + (with the same meaning as for -exec-) with -execdir. Sep 11, 2013 at 18:27
  • @DanielAndersson + does not always generate only one invocation. It generates less invocations than ;.
    – nekketsuuu
    Mar 30, 2018 at 10:34


Using the + in -exec is the same as -exec, except that {} is replaced with as many pathnames as possible for each invocation of utility.

Slightly longer from man find on my computer:

   -exec utility [argument ...] ;
             True if the program named utility returns a zero value
             as its exit status.  Optional arguments may be passed
             to the utility.
             The expression must be terminated by a semicolon.  If you
             invoke find from a shell you may need to quote the 
             semicolon if the shell would otherwise treat it as a control
             operator.  If the string ``{}'' appears anywhere in the 
             utility name or the arguments it is replaced by the pathname
             of the current file.
             Utility will be executed from the directory from which find was
             executed.  Utility and arguments are not subject to the further
             expansion of shell patterns and constructs.

     -exec utility [argument ...] {} +
             Same as -exec, except that `{}` is replaced with as many 
             pathnames as possible for each invocation of utility.  
             This behaviour is similar to that of xargs(1).

Notice the second paragraph. Do not stop reading after the first paragraph explaining -exec.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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