TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

244 pointsby infodroidover 7 years ago

21 comments

infodroidover 7 years ago
The chart was created by Andy Lester, the creator of ack, who thinks that more open source projects should point to their &quot;competing&quot; projects because it&#x27;s not really a competition: <a href="http:&#x2F;&#x2F;blog.petdance.com&#x2F;2018&#x2F;01&#x2F;02&#x2F;the-best-open-source-project-for-someone-might-not-be-yours-and-thats-ok&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blog.petdance.com&#x2F;2018&#x2F;01&#x2F;02&#x2F;the-best-open-source-pro...</a>
评论 #16097712 未加载
评论 #16098769 未加载
rozimover 7 years ago
The table is misleading isn&#x27;t it? It seems to imply that rg can&#x27;t work recursively, but [1] states &quot;..ripgrep defaults to recursive directory search...&quot;. I understand that the table might mean that rg doesn&#x27;t have a flag to enable recursive search, but surely we care about features more than flags...<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep#why-should-i-use-ripgrep" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep#why-should-i-use-ripgr...</a>
评论 #16097529 未加载
评论 #16097860 未加载
评论 #16097638 未加载
zellynover 7 years ago
Here to plug using `--passthru`&#x2F;`--passthrough`: it will print all lines, but highlight matches. I often do things like this to watch an output log, but highlight all entries with the string PLUGH in them:<p><pre><code> tail -F output.log | ag --passthrough &#x27;.*PLUGH.*&#x27;</code></pre>
评论 #16098132 未加载
评论 #16097983 未加载
评论 #16098275 未加载
memcoover 7 years ago
Seems pretty comprehensive. One confusing thing I found was these two: &quot;Don&#x27;t respect ignore files (.gitignore, .ignore, etc)&quot; vs &quot;Skip rules found in VCS ignore files (.gitignore, .hgignore, etc)&quot;<p>Aren&#x27;t those the same thing? Shouldn&#x27;t they be grouped for better comparison?
the_mitsuhikoover 7 years ago
I’m stuck with rg right now because it’s the only ine which correctly handles gitignore files. Generally quite happy with it but I wish it could also use a more powerful regex engine for some less common cases.<p>Most annoying thing is that $ does not work with windows newlines.
评论 #16098346 未加载
评论 #16097628 未加载
markildover 7 years ago
Not exactly sure what it is, but I really like this presentation format.<p>Thank you, have been trying to motivate myself to switch to ack&#x2F;ag for a while. This seems like it might be what I needed.
评论 #16097402 未加载
评论 #16097241 未加载
arca_voragoover 7 years ago
The one thing I wish more of these comparison tables had was licensing info, so for those like me who are curious:<p>1. GNU grep - GPLv3+<p>2. ack - Artistic License v2.0<p>3. ag (aka silver searcher) - Apache License 2.0<p>4. git-grep - GPlv2+&#x2F;LGPLv2.1+<p>5. rg - MIT license<p>So with maybe the exception of rg, all are gpl compatible, that&#x27;s great news.
评论 #16102544 未加载
评论 #16188062 未加载
fphilipeover 7 years ago
A nice feature of ag is the ability to limit the search to a certain file type. E.g. to only search ruby files: <i>ag --ruby foo</i>.<p>To see a list of supported types and the matching file extensions: <i>ag --list-file-types</i>.<p>Just checked and rg does have something similar, but you need to specify the type as an argument to a flag: <i>rg --type ruby foo</i>.
评论 #16097932 未加载
评论 #16098180 未加载
adamnemecekover 7 years ago
This chart doesn&#x27;t compare speed. Until rg, I didn&#x27;t grep much because I generally search through a lot of files. rg cuts through them in no time.
评论 #16097993 未加载
评论 #16098331 未加载
mbroshiover 7 years ago
Nice feature-level comparison.<p>Don&#x27;t know how you&#x27;d pull it off in the current tabular format, but would be great to include some of the UX side of things: For example, I use rg almost exclusively because it has an easy-to remember syntax (`rg search-string` is a recursive search), attractively colored and well-organized output, and seems much faster compared to other tools in my use cases.
nothrowsover 7 years ago
as a long time user of `find . -name &quot;*.foo&quot; -exec grep -Hin {} \;` moving to ack has been great! I love the syntax and the speed and the fact that it actually respects your ignore files. ripgrep is great too. ag on the other hand is recommended by everyone but doesn&#x27;t seem to respect ignores or understand modern ignore syntax. give it a pass.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ggreer&#x2F;the_silver_searcher&#x2F;issues&#x2F;385" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ggreer&#x2F;the_silver_searcher&#x2F;issues&#x2F;385</a><p>its been over 4 years... its had its chance.
评论 #16097309 未加载
评论 #16097555 未加载
评论 #16097227 未加载
satish-settyover 7 years ago
Seems everybody here has switched to rg but I haven&#x27;t because it&#x27;s not available in Debian repos (yet) unlike ack&#x2F;ag. So, do such folks use Arch or just download a pre-built binary ? How about updating rg when a new version is out ?
评论 #16099347 未加载
评论 #16100530 未加载
coldteaover 7 years ago
rg for the win. It&#x27;s not some huge improvement, but it&#x27;s more of a feeling that things just work by default (similar to what I get from tmux vs screen).
评论 #16097358 未加载
petreover 7 years ago
Ack and ag use Perl&#x2F;PCRE so they&#x27;re more useful than grep&#x2F;rg if you know Perl style regular expressions.
评论 #16098327 未加载
dh-gover 7 years ago
switched from ag to rg a few months ago and have nothing but good things to say about the experience.
评论 #16097308 未加载
评论 #16097284 未加载
评论 #16097281 未加载
visargaover 7 years ago
Any modern tools like this?<p>sary - a suffix array library and tools <a href="http:&#x2F;&#x2F;sary.sourceforge.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;sary.sourceforge.net&#x2F;</a><p>It finds words in O(log(n)) time by using an additional index.
评论 #16099080 未加载
masklinnover 7 years ago
&gt; No descending into subdirectories<p>&gt; Limit directory search depth<p>These could be the same item, the former is a special case of the latter.
akerroover 7 years ago
The table somehow missed MIT grep.
caio1982over 7 years ago
What has always amazed me is how super fast ack is in my use cases.
hashkbover 7 years ago
I&#x27;ve been using pt for a few years... am I dumb or do I have a secret?
评论 #16102563 未加载
iameliover 7 years ago
Missing `git grep --name-only`
评论 #16106457 未加载