Feature comparison of ack, ag, git-grep, GNU grep and ripgrep
There are many greplike tools available to choose from. ripgrep is currently the fastest, which folks seem to focus on, but they have different features. Here's a chart to help you see which tools can do what.
If you find this chart useful, consider making one for the projects you run, even if it includes "competing" projects. The best project for someone might not be your project, and that's OK.
If you have updates to the chart, please submit as a GitHub issue.
ack | ag | git-grep | GNU grep | rg | |
---|---|---|---|---|---|
Name | ack | The Silver Searcher | git-grep | GNU grep | ripgrep |
Project page | Link | Link | Link | Link | Link |
Language | Perl | C | C | C | Rust |
License | Artistic License 2.0 | Apache License 2.0 | GPL 2 | GPL 3 | MIT/Unlicense |
Regular expressions | Native Perl | Perl-compatible | Basic, extended, or Perl-compatible | Basic, extended, or Perl-compatible (experimental) | Fast non-backtracking, Perl-compatible, or automatic selection |
Feature | ack | ag | git-grep | GNU grep | rg |
Search where | anywhere | anywhere | git repository by default, or anywhere with --no-index | anywhere | anywhere |
Search git history | ✔ | ||||
Include/exclude files by filetype | ✔ | ✔ | ✔ | ||
Specify filetype by file extension | ✔ | ✔ | ✔ | ||
Specify filetype by pattern match on filename | ✔ | ✔ | ✔ | ✔ | |
Specify filetype by pattern match on first line of file | ✔ | ||||
Configuration file | System-, user- and project-level | System-, user- and project-level | Specified by RIPGREP_CONFIG_PATH environment variable | ||
Ignore files based on .gitignore or .ignore files | ✔ | ✔ | ✔ | ||
Parallelism | ✔, threads | ✔, threads | ✔, threads | ||
Deterministic output | ✔, using --sort-files | ✔, using --sort path | |||
Match patterns across newlines | ✔ | ✔ | |||
Smart case searching | ✔ | ✔ | ✔ | ||
Multiple patterns with boolean expressions | ✔ | ||||
Print lines by number | ✔ | ||||
Show proximity of matches to other matches | ✔, in ack 3 | ||||
Build output for each line based on match groups | ✔ | ✔ | |||
Limit length of output lines | ✔ | ✔ | |||
Underline matches to show matches w/o color | ✔ | ||||
Search in gzip files | ✔ | ✔ | |||
Searching | ack | ag | git-grep | GNU grep | rg |
Ignore case | ✔ | ✔ | ✔ | ✔ | ✔ |
Smart case searching (case-insensitive unless the pattern contains a capital letter) | ✔ | ✔ | ✔ | ||
Re-enable case-sensitive search over case-insensitive or smart-case search | ✔ | ✔ | ✔ | ✔ | |
Match whole words | ✔ | ✔ | ✔ | ✔ | ✔ |
Invert match | ✔ | ✔ | ✔ | ✔ | ✔ |
Match entire line only | ✔ | ✔ | |||
Specify pattern explicitly | ✔ | ✔ | ✔ | ✔ | |
Read patterns from a file | ✔ | ✔ | ✔ | ||
Specify multiple patterns with boolean expressions | ✔ | ||||
Match patterns across newlines | ✔ | ✔ | |||
Print specific lines by number | ✔ | ||||
Regular expressions | ack | ag | git-grep | GNU grep | rg |
Use fixed strings, not regular expressions, for a literal match | ✔ | ✔ | ✔ | ✔ | ✔ |
Use basic regular expressions | ✔ | ✔ | |||
Use extended regular expressions | ✔ | ✔ | |||
Use Perl (or Perl-compatible) regular expressions | ✔ | ✔ | ✔ | ✔ | ✔ |
Search output | ack | ag | git-grep | GNU grep | rg |
Print only filenames that contain matches | ✔ | ✔ | ✔ | ✔ | ✔ |
Print only filenames that do not contain matches | ✔ | ✔ | ✔ | ✔ | ✔ |
Show only the part of a line that matched | ✔ | ✔ | ✔ | ✔ | |
Specify output for each line match | ✔ | ✔ | |||
Print the filename for each match | ✔ | ✔ | ✔ | ✔ | ✔ |
Suppress the prefixing filename on output | ✔ | ✔ | ✔ | ✔ | ✔ |
Print paths relative to the project top directory | ✔ | ||||
Prefix the line number to matching lines | ✔ | ✔ | ✔ | ✔ | |
Suppress line numbers | ✔ | ✔ | ✔ | ||
Print a heading of each file's name before its matches | ✔ | ✔ | ✔ | ✔ | |
Specify filename to show for matches on STDIN | ✔ | ||||
Show the column number of the first match | ✔ | ✔ | ✔ | ||
Print lines of context after matches | ✔ | ✔ | ✔ | ✔ | ✔ |
Print lines of context before matches | ✔ | ✔ | ✔ | ✔ | ✔ |
Print lines of context before and after matches | ✔ | ✔ | ✔ | ✔ | ✔ |
Show number of lines matching per file | ✔ | ✔ | ✔ | ✔ | ✔ |
Print null byte as separator between filenames | ✔ | ✔ | ✔ | ✔ | ✔ |
Stop searching in each file after NUM matches | ✔ | ✔ | ✔ | ✔ | |
Stop searching after one match of any kind | ✔ | ||||
Print the byte offset within the file before each line | ✔ | ✔ | |||
Suppress error messages about nonexistent or unreadable files | ✔ | ✔ | ✔ | ✔ | |
Limit length of output lines | ✔ | ✔ | |||
Do not output matched lines | ✔ | ✔ | ✔ | ||
Print stats (files scanned, time taken, etc.) | ✔ | ✔ | |||
File presentation | ack | ag | git-grep | GNU grep | rg |
Enable color output | ✔ | ✔ | ✔ | ✔ | ✔ |
Underline matches | ✔ | ||||
Set colors for various output items | ✔ | ✔ | ✔ | ✔ | ✔ |
Pipe output through a pager or other command | ✔ | ✔ | |||
Separate match output with blank lines unless they are on adjacent lines | ✔ | ||||
Group together all matches in a file | ✔ | ✔ | ✔ | ||
Specify group separator | ✔ | ||||
Show the function name of the match | ✔ | ||||
Show the function in which a match was found | ✔ | ||||
Print a break between results from different files | ✔ | ✔ | |||
Flush output on every line | ✔ | ✔ | ✔ | ||
File finding | ack | ag | git-grep | GNU grep | rg |
Only print the files selected, without searching | ✔ | ✔ | |||
Show which types each file has | ✔ | ||||
List searchable files that match a pattern | ✔ | ✔ | ✔ | ||
Read the list of files to search from FILE | ✔ | ||||
Sort the found files lexically | ✔ | ✔ | |||
Read the list of files to search from STDIN | ✔ | ||||
Limit search to filenames matching a pattern | ✔ | ✔ | |||
Search hidden files | ✔ | ✔ | |||
File inclusion/exclusion | ack | ag | git-grep | GNU grep | rg |
Search only files of a given type | ✔ | ✔ | ✔ | ||
Exclude files of a given type | ✔ | ✔ | |||
Recurse into subdirectories | ✔ | ✔ | ✔ | ✔ | |
Recurse into subdirectories, following symlinks | ✔ | ✔ | |||
No descending into subdirectories | ✔ | ✔ | ✔ | ||
Add/remove directory from list of ignored dirs | ✔ | ✔ | ✔ | ||
Don't respect ignore files (.gitignore, .ignore, etc) | ✔ | ||||
Ignore files larger than a given size | ✔ | ||||
Specify files to search | ✔ | ✔ | |||
Ignore files/directories matching | ✔ | ✔ | ✔ | ||
Add filter for ignoring files | ✔ | ✔ | |||
Include only files of recognized types | ✔ | ✔ | |||
Follow symlinks | ✔ | ✔ | ✔ | ||
Don't follow links to other devices | ✔ | ✔ | ✔ | ||
Search all types of files | ✔ | ||||
Limit directory search depth | ✔ | ✔ | ✔ | ||
Search binary files | ✔ | ✔ | |||
Treat files as binary | ✔ | ||||
Don't search in binary files | ✔ | ||||
Treat binary files as if they were text | ✔ | ✔ | |||
Search all text files | ✔ | ✔ | |||
Search all files | ✔ | ✔ | |||
Skip rules found in VCS ignore files (.gitignore, .hgignore, etc) | ✔ | ✔ | ✔ | ||
File type specification | ack | ag | git-grep | GNU grep | rg |
Create a filetype, replacing the previous specs | ✔ | ||||
Add specifications to an existing filetype | ✔ | ✔ | |||
Remove a file type | ✔ | ✔ | |||
Ignore default type definitions | ✔ | ||||
Display all known types | ✔ | ✔ | ✔ | ||
Miscellaneous | ack | ag | git-grep | GNU grep | rg |
Print all lines, whether matching or not | ✔ | ✔ | ✔ | ||
Outputs a default ackrc for your customization to standard output | ✔ | ||||
Dump information on which options are loaded | ✔ | ✔ | |||
Specify a configuration file to use | ✔ | ||||
Ignore environment variables and global configuration files | ✔ | ✔ | |||
Treat standard input as a pipe | ✔ | ||||
Search contents of compressed files (e.g. gzip) | ✔ | ✔ | |||
Specify input file encoding | ✔ |