find command builder
Choose conditions and an action to get a find command, every part explained, and see first which files it finds in a sample directory.
find . -type f -name '*.log' -mtime +73 found
. is the current directory; a path such as /var/log works too
Empty: no limit; 1: only what is directly in the starting point
Only its name, such as node_modules or .git; find will not go into it
Empty conditions are not used; the ones filled in must all hold.
* is any characters, ? one character: *.log, report-??.txt
Sizes are rounded up to whole units before comparing
"Before 7 days" is -mtime +7, "in the last 7 days" is -mtime -7
Octal, such as 644, 777, 4000 (setuid)
find .Start in the current directory and search everything below it-type fOnly regular files-name '*.log'The name matches *.log: * is any characters, ? one character. The quotes make find, not the shell, expand the *-mtime +7Last changed more than 7 days ago. Whole days count: +7 is "over 7 whole days", so at least 8 days ago
Run in the simulator on the sample directory /home/user/project (whatever the starting point says); none of your files are touched.
3 found
./logs/app-2026-10.log ./logs/error.log ./logs/system.log
The directory the preview searches; the rows found are marked.
| Path | Mode | Owner | Size | Changed |
|---|---|---|---|---|
| README.md | -rw-r--r-- | user | 1K | 3 days ago |
| notes.txt | -rw-r--r-- | user | 0 | 30 minutes ago |
| backup.tar.gz | -rw-r--r-- | user | 1.4M | 20 days ago |
| config | drwxr-xr-x | user | yesterday | |
| config/app.conf | -rw-r--r-- | user | 800 | 8 days ago |
| config/secret.env | -rw------- | user | 120 | 4 days ago |
| logs | drwxr-xr-x | user | 45 minutes ago | |
| logs/app.log | -rw-r--r-- | user | 39K | 45 minutes ago |
| logs/app-2026-10.log | -rw-r--r-- | user | 293K | 40 days ago |
| logs/error.log | -rw-r--r-- | user | 0 | 9 days ago |
| logs/system.log | -rw-r----- | root | 5K | 12 days ago |
| node_modules | drwxr-xr-x | user | 60 days ago | |
| node_modules/lib | drwxr-xr-x | user | 60 days ago | |
| node_modules/lib/index.js | -rw-r--r-- | user | 4K | 60 days ago |
| node_modules/lib/package.json | -rw-r--r-- | user | 200 | 60 days ago |
| scripts | drwxr-xr-x | user | 5 days ago | |
| scripts/deploy.sh | -rwxr-xr-x | user | 600 | 5 days ago |
| scripts/setup.sh | -rwxrwxrwx | user | 900 | 15 days ago |
| src | drwxr-xr-x | user | yesterday | |
| src/app.js | -rw-r--r-- | user | 2K | yesterday |
| src/Main.JS | -rw-r--r-- | user | 300 | 2 days ago |
| src/util.js | -rw-r--r-- | user | 512 | 10 days ago |
| tmp | drwxr-xr-x | user | 2 days ago | |
| latest.log → logs/app.log | lrwxrwxrwx | user | 12 | 45 minutes ago |
- Quote patterns: in find . -name *.log the shell may expand * to names in the current directory first, and the result is wrong.
- Conditions are tested left to right; side by side they mean "and", -o means "or", ! means "not"; group with \( … \).
- -mtime counts whole days: +7 is over 7 whole days (at least 8 days ago), -7 is within 7 days, 7 is the 7th day exactly.
- Before deleting, run it without -delete and read the list; -delete goes after every condition.
- -exec … \; runs once per file; -exec … + hands many files to one run, much faster.
- Searching from /, add 2>/dev/null to drop the "Permission denied" errors.