find -exec
One very useful command for locating files and performing operations on them is find with the -exec option.
find [path] [arguments] -exec [command] {} \;
The part that’s tricky to remember is the escaped semicolon at the end.
Per-file vs batch mode
The \; terminator runs the command once per file found:
find . -name "*.log" -exec rm {} \;
# Equivalent to: rm file1.log; rm file2.log; rm file3.log
The + terminator batches files into fewer command invocations, which is faster: