🐧 Linux / Shell Scripting
Beginner
How does the find command work?
Answer
find path [options] [expression] searches for files and directories matching given criteria. Common options: -name "*.log" (by filename pattern), -type f (files only) or -type d (directories only), -mtime -7 (modified in last 7 days), -size +100M (larger than 100 MB), -user alice (owned by user). Execute a command on each result with -exec rm {} \; or pass results to another command with -print0 | xargs -0. Example: find /var/log -name "*.log" -mtime +30 -delete removes log files older than 30 days.
Previous
How does grep work for searching text?
Next
How do chmod and chown control file permissions?