Find Command TLDR Cheatsheet

Search for files and directories:

find <path> <options>

Find regular files/folders:

find <path> -type f
find <path> -type d  

Find by name (case-insensitive):

find <path> -iname "<pattern>"

Find files larger than 10MB:

find <path> -size +10M

Run a command on each found file:

find <path> <options> -exec <command> {} \;

Examples using -exec:

# Delete found files
find <path> -type f -name "*.log" -exec rm {} \;

Move files to another directory

find <path> -type f -name "*.txt" -exec mv {} /destination/dir/ \;

Syntax for -exec

-exec cmd {} \ # {} the placeholder for file