CLI AI

Stop memorizing find flags: ask for what you want

2026-01-13

find is the Swiss army knife of Unix file searches. It's also the tool everyone Googles. Is the size flag +100M or +100MB? Does -mtime -7 mean less than seven days ago or more than? You can keep half the man page in your head, or you can stop trying.

A scenario

It's Friday afternoon, the build server is running out of disk, and you need to know what's eating it. You don't need a complete inventory — you need the four or five queries you'd type if you remembered the flags.

Files over 100 MB

clai
$ clai find files larger than 100MB in this directory→ find . -type f -size +100M -printf '%s\t%p\n' | sort -rn | head -20./build/output.bin     142876160./logs/2026-04.json    113246208./assets/raw.tar       104857600

Combine size and time

clai
$ clai files over 50MB modified in the last week→ find . -type f -size +50M -mtime -7 -printf '%TY-%Tm-%Td %s %p\n'2026-04-26 142876160 ./build/output.bin2026-04-23 73400320 ./cache/db.dump

Filter by extension

clai
$ clai find log files larger than 10MB→ find . -type f -name '*.log' -size +10M./var/log/app.log./var/log/nginx/access.log

Top 10 largest directories

clai
$ clai show me the 10 largest directories under this folder→ du -hx --max-depth=2 . 2>/dev/null | sort -hr | head -102.4G    ./node_modules1.1G    ./.cache640M    ./logs

When the first answer isn't right

If clai gives you du -h | sort -h | tail when you wanted the top 10, press R and add context — "top 10, descending, human-readable". The refinement loop is built for exactly this; the post on refining has the full pattern.

What it didn't replace

find's -exec chains and the more arcane predicates (-newer, -prune) still pay off if you live in them daily. But for the 90% case — files of size X, in directory Y, matching pattern Z — describing it in words is faster than recalling the syntax.

Once you've cleared out the big files, the logs and backups cleanup post covers the next step.