grep
Classic Unix command-line utility for searching text with regular expressions.
HN commenters value grep for being fast and flexible with no indexing step12, and for coming preinstalled, so it is there on any server they log into.34 The main caveat is that a recursive grep also scans binary files and can be slow5, and some commenters switch to ripgrep for very large files.6
Why people recommend it
Simple and sufficient · 3
Commenters call it a simple tool that is good enough for everyday searching.
“It is good to know grep, sed, and awk”
“I use grep, emacs, and I don't feel like I have anything that needs mitigation.”
Show 1 more
“I use grep a lot in an ad hoc manner on really large files I switch to rg.”
Speed · 2
Described as very fast, even faster than IDE search when there is no code index.
“In general, in my experience, grep is better than almost anything else you can use.”
“grep is great. It comes pre-installed on your OS.”
Preinstalled everywhere · 2
It ships with the OS, so it is available on random servers where replacements are missing.
“grep is great. It comes pre-installed on your OS.”
“the closer my setup is to the default one, the better”
No indexing · 1
It needs no indexing pass and is never out of date.
“In general, in my experience, grep is better than almost anything else you can use.”
Caveats and dissent
Slow recursive scans · 1
`grep -r` also scans binary files rather than just source files, which can make it very slow.
“grep is great. It comes pre-installed on your OS.”
Very large files · 1
One commenter switches to ripgrep for really large files.
“I use grep a lot in an ad hoc manner on really large files I switch to rg.”
Often compared with
Threads where it came up
- Local Indexing to reduce tool calling and token usage 1 mention
- Ask HN: Navigating Source Code (especially on large projects) 1 mention
- Source Code Grep: Use your own grep, but make it source code aware 1 mention
- A Faster Alternative to Jq 1 mention
- Ripgrep is faster than {grep, ag, Git grep, ucg, pt, sift} 1 mention
- Grep, Sed, Awk – The Unix Text Processing Trinity 1 mention
Data: grep.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.
All comments 7
“In general, in my experience, grep is better than almost anything else you can use.”
“I use grep, emacs, and I don't feel like I have anything that needs mitigation.”
“grep is great. It comes pre-installed on your OS.”
“I use grep a lot in an ad hoc manner on really large files I switch to rg.”
“the closer my setup is to the default one, the better”
“It is good to know grep, sed, and awk”
“I love grep”