Basic Syntax
find [path] [options] [expression]
Find by Name
# Exact name
find /var/www -name "index.php"
# Case-insensitive
find / -iname "readme.md"
# Wildcards
find /etc -name "*.conf"
Find by Type
# Files only
find /var -type f -name "*.log"
# Directories only
find /home -type d -name ".ssh"
# Symbolic links
find / -type l
Find by Size
# Files larger than 100MB
find / -type f -size +100M
# Files smaller than 1KB
find /tmp -type f -size -1k
# Empty files
find /var/log -type f -empty
Find by Time
# Modified in last 24 hours
find /var/www -type f -mtime -1
# Accessed more than 30 days ago
find /tmp -type f -atime +30
# Changed in last 60 minutes
find /etc -type f -mmin -60
Actions
# Delete files
find /tmp -type f -name "*.tmp" -delete
# Execute command on each result
find /var/www -name "*.php" -exec grep -l "eval(" {} \;
# Change permissions
find /var/www -type d -exec chmod 755 {} \;
find /var/www -type f -exec chmod 644 {} \;