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

i finally stopped typing grep -r

After years of grep -r and find, swapping to ripgrep and fd for everyday searching, and why the muscle memory was the hardest part.

A terminal showing a fast search across a code tree

I have typed grep -rn --include='*.go' so many times that my fingers do it without consulting me. So it took an embarrassingly long time to admit that rg foo does the same thing, faster, and already knows to skip my .git directory and respect .gitignore. ripgrep doesn't search the 4GB of node_modules I forgot was there. grep cheerfully would, and has, and I've waited for it.

The speed is the headline, and it is genuinely good on a big repo, but the part that actually changed my habits is the defaults. Sane defaults beat raw speed when you use a tool fifty times a day. rg searches recursively from the current directory because that's what you wanted; it highlights matches because that's what you wanted; it skips binary and ignored files because that's what you wanted. I no longer assemble a small incantation each time.

fd is the same story for find. Compare find . -name '*.toml' -not -path './target/*' with fd -e toml. One of those I can type whilst thinking about something else.

The hard part wasn't installing them, it was the muscle memory. For the first fortnight I'd type grep -r out of reflex, catch myself, and start again. I aliased nothing, deliberately, because I wanted the new names to stick. They have. The old tools are still there for the day I'm on a box that isn't mine, and that's fine. On my own machine I've quietly stopped reaching for them.