find

Locate files by name, type, size, time, and more. Combine with -exec for powerful workflows.

Synopsis

find [path] [expression]

Core Options

-name 'pattern'

Match by filename (case-sensitive).

-type f|d|l

Filter by file type (file/dir/link).

-mtime +/-N

Modified time in days.

-size +/-N

File size (e.g., +100M).

-maxdepth N

Limit directory traversal depth.

-exec cmd {} \;

Run a command for each match.

-print0

Null-terminate output for safe piping to xargs -0.

Usage Examples

Find Large Files

Find files over 100MB.

find . -type f -size +100M

Find by Extension

Find all .log files up to 2 levels deep.

find . -maxdepth 2 -type f -name '*.log'

Find Recently Modified

Files modified in the last 24 hours.

find . -type f -mtime -1

Delete Matching Files

Delete all .tmp files safely.

find . -type f -name '*.tmp' -delete

Exec Command

Run wc -l on each Python file.

find . -type f -name '*.py' -exec wc -l {} \;
Built for builders.