Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

ripgrep, fd, and finally letting grep retire

Why I replaced grep and find with ripgrep and fd, and the muscle memory it took to make it stick.

A code editor on a dim screen

I held out on this for a long time. grep and find have been on every machine I've touched for twenty years, and there's a stubborn comfort in tools that are simply always there. You don't have to think about installing them. You don't have to remember a different flag set. They are the floor of the room.

What finally moved me was a search that took eleven seconds on a moderately sized monorepo, the kind of pause where you start questioning whether you typed the command right. The same search with ripgrep came back before I'd finished exhaling. That's not a benchmark, it's just the moment I stopped arguing with myself.

what actually changed

The headline reason ripgrep is fast is that it respects your .gitignore by default. It isn't grepping through node_modules, build artefacts and a gigabyte of vendored dependencies, because it knows you don't care about them. That single default does most of the work. Add a genuinely good regex engine underneath and parallel traversal on top, and the speed stops being surprising.

The day-to-day shape is nicer too. Recursive is the default, so no more grep -rn. Line numbers are on. Matches are coloured sensibly. The thing you wanted is the thing you get without four flags.

# the old reflex
grep -rn "AuthToken" --include="*.go" .

# the new one
rg AuthToken -tgo

fd is the same story aimed at find. The find syntax has always read like a small hostile language: -name, -type, the implicit -print, the predicate ordering you have to get right. fd is what you'd guess if you'd never been hurt before.

# find every .env file, skipping ignored dirs
fd -H '\.env$'

# all the rust files modified in the last day
fd -e rs --changed-within 1d

the bit nobody warns you about

The tools are easy. The muscle memory is not. For the first fortnight my fingers typed grep and find on reflex, and I had to consciously stop and retype. I resisted aliasing grep to rg, because the two aren't drop-in equivalents and I didn't want to learn a lie. The flags differ, the ignore behaviour differs, and one day I'd ssh onto a box without ripgrep and find my reflexes broken. So I kept the real names real and just trained the new ones in.

A month on, the old reflex is gone. I reach for rg and fd first, and the rare time I land on a stock box with neither, plain grep -rn is still right there in my fingers as a fallback. That's the outcome I wanted: new defaults, old skills intact.

I'm not evangelical about replacing every classic tool with a Rust rewrite. A lot of that churn is fashion. But these two earned the swap on the only metric that matters, which is that I now find what I'm looking for faster and think about it less.