Cheatsheet: find

Last updated 2026-06-21

Names and types

Find files by exact name

find . -name 'package.json'

Find files by case-insensitive name

find . -iname '*.jpg'

Find regular files only

find src -type f

Find directories only

find . -type d -name 'node_modules'

Find symbolic links

find . -type l

Size, time, and state

Find files larger than 100 MB

find . -type f -size +100M

Find files smaller than 1 KB

find . -type f -size -1k

Find files modified in the last 7 days

find . -type f -mtime -7

Find files modified more than 30 days ago

find . -type f -mtime +30

Find empty files or directories

find . -empty

Actions

Run a command for each matching file

find . -name '*.log' -exec gzip {} \;

Run one command with many matched files

find . -name '*.js' -exec grep -n 'TODO' {} +

Preview files before deleting

find . -name '*.tmp' -print

Delete matching files

find . -name '*.tmp' -delete

Process children before parents

find . -depth -name '*.bak' -delete

Permissions and logic

Find files with an exact permission mode

find . -type f -perm 0644

Find files with any executable bit set

find . -type f -perm /111

Prune a directory from the search

find . -path './node_modules' -prune -o -type f -name '*.ts' -print

Match multiple name patterns

find . \( -name '*.jpg' -o -name '*.png' \) -type f

Combine criteria with AND by listing them together

find . -type f -name '*.log' -size +10M -mtime +7

See also: