I'm curious as to what the {} in the following command is actually for?

Example Command:

find /foo/ -name "*.txt" -exec rm -v {} \;

The Man page provided a small blurb but it confused me a little bit:

The string '{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find.


That's the symbol that gets replaced by the file name that find comes up with.

  • Ah that makes sense and could i add another argument after that? – chrisjlee Feb 1 '12 at 16:27
  • 6
    You can add whatever you like: it is just an argument. pretty much like "$a-single-output-file-name" when -exec ends with \; ... but it means "$multiple" "$output" "$filenames" when -exec ends with \+ – Peter.O Feb 1 '12 at 16:35
  • Good comment by Peter.O :). See also related answer to Question on find -exec – Tatjana Heuser Feb 1 '12 at 18:04

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.