Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

With respect to the following find command-line

find . -type f -exec grep -l strings {} \;

I do not understand the usage of -exec and {} \.

share|improve this question

For each find (or directory) found, execute the following command:

grep -l strings {} \;

The {} is the place holder, which stands for the file/directory found. The \; is syntactically required.

share|improve this answer
the \; terminates the argument to -exec (it tells find to stop parsing the arguments as belonging to the command you want to run). You could pretty much use ";" or ';' instead - the point is, that without escaping the semicolon would be treated as command separator by the shell itself. – peterph Nov 13 '12 at 22:51
@peterph: Right on. Thank you for the explanation. – Hai Vu Nov 13 '12 at 23:45

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.