Unix find command, what are the {} and \; for?

See man find. (particular the part about -exec)

When using -exec to run a command on each of the files found, the {} is replaced with the name of each file found, and the command is terminated by \;

In your example, all files found under the current directory (.), matching the name *.clj will have the command grep -r resources run on them (to find the string resources if it exists in each of those files).

It’s actually somewhat redundant, since -r is for recursively searching subdirectories, and that’s what find is already doing.

Leave a Comment