How to Search for Files in Linux (find)

find searches a directory tree for files and directories matching criteria like name, type, size, or modification time.

Published September 30, 2026

find searches directory trees for files by name, type, size, age or permissions, and can run commands on the results.

How it works

Syntax: find <start> <tests> <action>. Tests include -name, -type, -size, -mtime and -perm. The default action prints matches.

Use -exec or xargs to act on results.

Try it

find . -name "*.log" -mtime +7
./logs/app.log
./logs/old.log

Practical examples

By name

find /var/www -name "*.php"

Files larger than 100 MB

find / -type f -size +100M 2>/dev/null

Delete old files

find /tmp -type f -mtime +30 -delete

Run a command on results

find . -name "*.js" -exec grep -l "TODO" {} +

Common mistakes

  • Using -delete before testing the expression.
  • Forgetting quotes around patterns so the shell expands them.
  • Searching / without limits.

Key takeaways

  • find walks directories and filters.
  • Preview before -delete.
  • -exec or xargs act on results.

FAQ

find vs locate?

locate uses a database and is faster but may be outdated.

Case-insensitive name?

Use -iname.

More Linux articles