← All cheatsheets

Shell

Finding files fast — find, fd, locate, ripgrep

Find files fast with find, fd, locate and ripgrep: match by name, age or type, skip node_modules, and search file contents.

find

find . -name "*.md" — by name

find . -name "*.md" -mtime -7 — modified in last 7 days

find . -name "*.tmp" -delete — find and delete

find . -type d -name node_modules -prune -o -name "*.ts" -print — skip node_modules

fd (modern find)

fd pattern — fast, intuitive

fd -e md — by extension

fd -t f pattern — files only

locate (indexed search)

locate name — instant, may be stale (updatedb to refresh)

ripgrep (rg)

rg "pattern" — recursive grep, fast

rg -t md "pattern" — markdown files only

rg -l "pattern" — list files with matches

rg -c "pattern" — count matches per file