When comparing ripgrep vs The Silver Searcher (Ag), the Slant community recommends ripgrep for most people. In the question“What are the best shell powertools?” ripgrep is ranked 3rd while The Silver Searcher (Ag) is ranked 4th. The most important reason people chose ripgrep is:
ripgrep has performance similar to raw grep but provides similar level of usability as The Silver Searcher or ACK.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Fast
ripgrep has performance similar to raw grep but provides similar level of usability as The Silver Searcher or ACK.
Pro Supports VCS ignore files
ripgrep can speed up by ignoring files matched by pattern in ".rgignore" (deprecated), ".ignore" (since rg-v0.2.0), and VCS ignore files (e.g., currently only ".gitignore").
Pro Speedy even with Unicode (UTF-8) searches
Pro Lock-free parallel recursive directory search
Pro ripgrep lets you only search certain types of files via file type whitelist
Pro Really fast
It is written in C. It is up to 10 times faster than ack.
Pro Simple syntax
Ack-compatible.
Pro Ignores files in .gitignore by default
It ignores file patterns from your .gitignore
, .hgignore
and .ignore
. This can be a bit buggy though.
Pro Supports PCRE RegExp
Supports RegEx like look-ahead/behind (only fixed length lookbehind however).
Pro No need to manage another config file or learn a new config syntax
Everything is managed with command line args, meaning you can store commonly used options through .bashrc
aliases, bash scripts, and/or autocompletion. There is no config file format to learn or extra dotfiles to manage.
Cons
Con Does not support encodings other than UTF-8
If you need to search files with text encodings other than UTF-8 (like UTF-16), then ripgrep won’t work. ripgrep will still work on ASCII compatible encodings like latin1 or otherwise partially valid UTF-8. ripgrep may grow support for additional text encodings over time.
Con Does not support decompression
If you need to search compressed files, ripgrep doesn’t try to do any decompression before searching.
Con Does not support arbitrary lookahead/lookbehind assertions
However, it's supported since ripgrep v0.10.0 (2018-09-07)
https://github.com/BurntSushi/ripgrep/blob/master/CHANGELOG.md#0100-2018-09-07
Con Does not support backreferences
However, it's supported since ripgrep v0.10.0 (2018-09-07)
https://github.com/BurntSushi/ripgrep/blob/master/CHANGELOG.md#0100-2018-09-07
Con You have to remember commonly used options and add them as flags everytime
You are not able to define options in a config file as there is none. (You have to use a shell alias or wrapper script to get your default options.)
Con Cannot add custom file types
All file types ag is able to search for are baked into the executable. There is no way to add new ones neither via command line nor via (the not existing) config file. The only way is a pull request on github and waiting for a new release.