← All cheatsheets

Shell

Finding files fast — find, fd, locate, ripgrep

## 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