find [路径] [条件] -exec 命令 {} \;
{}:代表查找到的每个文件
\;:命令结束符(必须转义或加引号)
# 复制大于10MB的文件到/mnt
find /boot -size +10M -exec cp {} /mnt \;
# 删除临时文件
find /tmp -name "*.tmp" -delete
# 显示找到文件的详细信息
find /var/log -name "*.log" -exec ls -lh {} \;
# 修改文件权限
find /home -type f -exec chmod 644 {} \;
find / -type f -name "*.conf" -print0 | xargs -0 grep -l "error"
# 统计文件数量
find /var/log -type f | wc -l
# 批量删除
find /tmp -name "*.tmp" -print0 | xargs -0 rm -f