Find by name, current directory down
find . -name "*.log"
Quote the pattern or the shell expands it before find sees it.
The find commands you reach for every day, by name, type, time and size, plus the actions and combinators that turn a match into work done.
find . -name "*.log"
Quote the pattern or the shell expands it before find sees it.
find . -iname "*.log"
find . -type f
find . -type d
find . -mtime -1
The sign is backwards from what feels natural: -1 is less than a day old, +1 is more than a day old.
find . -size +10M
+ is bigger than, - is smaller than. Units: k, M, G.
find . -name "*.tmp" -delete
-delete must come last. Put it before -name and it deletes everything.
find . -name "*.log" -exec rm {} \;
{} is the match. \; runs the command once per match; + batches many matches into one call.
find . -name "*.js" -o -name "*.ts"
-a is and (implied between tests, so you can leave it out), -o is or, ! negates.
fd XYZ
Replaces find . -name "*XYZ*". Install with brew install fd.