Find Command Cheat Sheet
Basic Find Command Usage
find /path -name "filename" - Search for a file by name.
find /path -iname "filename" - Case-insensitive search.
find . -type f - Find all files in the current directory.
find . -type d - Find all directories in the current directory.
Searching by File Size
find /path -size +100M - Find files larger than 100MB.
find /path -size -500k - Find files smaller than 500KB.
Searching by Modification Time
find /path -mtime -7 - Find files modified in the last 7 days.
find /path -mtime +30 - Find files modified more than 30 days ago.
find /path -cmin -60 - Find files changed in the last 60 minutes.
Searching by Permissions
find /path -perm 644 - Find files with exact 644 permissions.
find /path -perm -u=x - Find files where the owner has execute permissions.
find /path -perm -o=w - Find files that others can write to.
Executing Commands on Found Files
find /path -type f -exec ls -lh {} \; - List details of found files.
find /path -type f -exec rm {} \; - Delete found files.
find /path -type f -print0 | xargs -0 rm - Delete files safely with `xargs`.
Combining Conditions
find /path \( -name "*.txt" -o -name "*.log" \) - Find `.txt` or `.log` files.
find /path -type f -size +10M -mtime -7 - Find files larger than 10MB modified in the last 7 days.