find
Search for files and directories in a directory hierarchy with powerful filters.
Synopsis
find [PATH]... [EXPRESSION]...
Examples
find . -name '*.log'
find /tmp -type f -mtime +30 -delete
find . -type f -size +100M
find . -name '*.js' -exec grep -l 'TODO' {} +find . -maxdepth 1 -type d
Common options
| Flag | Description |
|---|---|
| -name | Match filename pattern |
| -type | Match file type (f=file, d=directory) |
| -mtime | Match by modification time in days |
| -size | Match by file size |
| -exec | Execute command on each match |
| -maxdepth | Limit directory descent depth |
About find
The `find` command search for files and directories in a directory hierarchy with powerful filters. Search commands help you locate files, text patterns, and executables across the filesystem.
Efficient searching is critical when working with large codebases or troubleshooting system issues. These tools range from simple filename lookups to full regular-expression pattern matching across file contents.
The command accepts 6 commonly used flags shown above, though the full set of options is available in the man page (`man find`). The 5 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Search Commands
Other commands in the Search category