find Favorites
Basic Name Search
find . -name "*.log"
Case Insensitive
find . -iname "*.PDF"
By Type (File/Directory)
# Files only
find . -type f -name "*.txt"
# Directories only
find . -type d -name "config"
Modified Time
# Last 24 hours
find . -type f -mtime -1
# More than 30 days ago
find . -type f -mtime +30
# Between 7 and 14 days ago
find . -type f -mtime +7 -mtime -14
By Size
# Larger than 100MB
find . -type f -size +100M
# Smaller than 1KB
find . -type f -size -1k
# Empty files
find . -type f -empty
By Permissions
# World-writable files
find . -type f -perm -002
# Executable files
find . -type f -perm /u+x
Execute Command on Results
# Delete found files
find . -name "*.tmp" -exec rm {} \;
# More efficient (batch)
find . -name "*.tmp" -exec rm {} +
Exclude Directory
find . -path ./.git -prune -o -name "*.py" -print
Multiple Conditions (AND)
find . -type f -name "*.log" -size +10M
Multiple Conditions (OR)
find . -name "*.jpg" -o -name "*.png"
Print with Null Separator (for xargs -0)
find . -name "*.log" -print0 | xargs -0 rm
Depth Limits
# Only current directory
find . -maxdepth 1 -name "*.txt"
# Skip first level
find . -mindepth 2 -name "*.txt"
Delete Empty Directories
find . -type d -empty -delete
Find and List with Details
find . -name "*.sh" -exec ls -lh {} \;
By Owner/Group
find /home -user evanusmodestus -type f
find /var -group wheel -type f