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

Note: ack 3 is currently in beta.

If you have updates to the chart, please submit as a GitHub issue.

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.

Searching ack ag git-grep GNU grep rg
Ignore case ‑i ‑‑ignore‑case
Smart case searching (case-insensitive unless the pattern contains a capital letter) ‑S ‑‑smart‑case ‑S ‑‑smart‑case ‑S ‑‑smart‑case
Re-enable case-sensitive search over case-insensitve or smart-case search ‑I ‑s ‑‑case‑sensitive ‑s ‑‑case‑sensitive
Match whole words ‑w ‑‑word‑regexp
Invert match ‑v ‑‑invert‑match
Match entire line only ‑x ‑‑line‑regexp ‑x ‑‑line‑regexp
Specify pattern explicitly ‑‑match ‑e ‑e ‑‑regexp ‑e ‑‑regexp
Read patterns from a file ‑f ‑f ‑‑file ‑f ‑‑file
Specify multiple patterns with boolean expressions ‑‑and ‑‑or ‑‑not ‑‑all‑match
Match patterns across newlines ‑‑[no‑]multiline
Print specific lines ‑‑lines
Regular expressions ack ag git-grep GNU grep rg
Use fixed strings, not regular expressions, for a literal match ‑Q ‑‑literal ‑Q ‑‑literal ‑F ‑‑fixed‑strings ‑F ‑‑fixed‑strings ‑F ‑‑fixed‑strings ‑‑fixed‑regexp ‑F ‑‑fixed‑strings
Use basic regular expressions ‑G ‑‑basic‑regexp ‑G ‑‑basic‑regexp
Use extended regular expressions ‑E ‑‑extended‑regexp ‑E ‑‑extended‑regexp
Use Perl (or Perl-compatible) regular expressions (always) ‑P ‑‑perl‑regexp ‑P ‑‑perl‑regexp (experimental)
Search output ack ag git-grep GNU grep rg
Print only filenames that contain matches ‑l ‑‑files‑with‑matches
Print only filenames that do not contain matches ‑L ‑‑files‑without‑match ‑L ‑‑files‑without‑match ‑L ‑‑files‑without‑match ‑L ‑‑files‑without‑match ‑‑files‑without‑match
Show only the part of a line that matched ‑o ‑o ‑‑only‑matching ‑o ‑‑only‑matching ‑o ‑‑only‑matching
Specify output for each line match ‑‑output ‑r ‑‑replace
Print the filename for each match ‑H ‑‑with‑filename ‑‑[no‑]filename ‑H ‑H ‑‑with‑filename ‑H ‑‑with‑filename
Suppress the prefixing filename on output ‑h ‑‑no‑filename ‑‑no‑filename ‑h ‑h ‑‑no‑filename ‑‑no‑filename
Print paths relative to the project top directory ‑‑full‑name
Prefix the line number to matching lines ‑‑[no‑]numbers ‑n ‑‑line‑number ‑n ‑‑line‑number ‑n ‑‑line‑number
Suppress line numbers ‑‑no‑numbers ‑N ‑‑no‑line‑number
Print a heading of each file's name before its matches ‑‑[no‑]heading ‑H ‑‑[no‑]heading ‑‑heading ‑‑[no‑]heading
Specify filename to show for matches on STDIN ‑‑label
Show the column number of the first match ‑‑[no‑]column ‑‑column
Print lines of context after matches ‑A ‑‑after
Print lines of context before matches ‑B ‑‑before
Print lines of context before and after matches ‑C ‑‑context
Show number of lines matching per file ‑c ‑‑count
Print null byte as separator between filenames ‑‑print0 ‑0 ‑‑null ‑‑print0 ‑z ‑‑null ‑Z ‑‑null ‑0 ‑‑null
Stop searching in each file after NUM matches ‑m ‑‑max‑count ‑m ‑‑max‑count ‑m ‑‑max‑count ‑m ‑‑max‑count
Stop searching after one match of any kind ‑1
Print the byte offset within the file before each line ‑b ‑‑byte‑offset ‑u ‑‑unix‑byte‑offsets
Suppress error messages about nonexistent or unreadable files ‑s ‑‑silent ‑s ‑‑no‑messages
Limit length of output lines ‑W ‑M ‑‑max‑columns
Do not output matched lines ‑q ‑‑quiet ‑q ‑‑quiet ‑‑silent ‑q ‑‑quiet
Print stats (files scanned, time taken, etc.) ‑‑stats ‑‑stats‑only
File presentation ack ag git-grep GNU grep rg
Enable color output ‑‑color
Set colors for various output items ‑‑color‑match ‑‑color‑filename ‑‑color‑lineno ‑‑color‑colno ‑‑color‑match ‑‑color‑path ‑‑color‑line‑number Specified in the .gitconfig file Specified in gnu_COLORS environment variable ‑‑colors
Pipe output through a pager or other command ‑‑[no‑]pager ‑O ‑‑open‑files‑in‑pager
Separate match output with blank lines unless they are on adjacent lines ‑‑[no‑]proximate
Group together all matches in a file ‑‑[no‑]group ‑‑[no‑]group
Specify group separator ‑‑[no‑]group‑separator
Show the function name of the match ‑p ‑‑show‑function
Show the function in which a match was found ‑W ‑‑function‑context
Flush output immediately, even when ack is used non-interactively ‑‑flush
Print a break between results from different files ‑‑[no‑]break ‑‑[no‑]break
Limit width of match lines ‑W ‑‑width
File finding ack ag git-grep GNU grep rg
Only print the files selected, without searching ‑f ‑‑files
Show which types each file has ‑‑show‑types
List searchable files that match a pattern ‑g ‑g
Read the list of files to search from FILE ‑‑files‑from
Sort the found files lexically ‑‑sort‑files ‑‑sort‑files
Read the list of files to search from STDIN ‑x
Limit search to filenames matching a pattern ‑G ‑‑file‑search‑regex
Search hidden files ‑‑hidden ‑‑hidden
File inclusion/exclusion ack ag git-grep GNU grep rg
Search only files of a given type ‑‑type=X ‑‑X (where X is a filetype) ‑‑X (where X is a filetype) ‑t ‑‑type
Exclude files of a given type ‑‑type=noX ‑‑noX (where X is a filetype) ‑T ‑‑type‑not
Recurse into subdirectories ‑r ‑R ‑‑[no‑]recurse ‑r ‑‑recurse ‑r ‑‑recursive
Recurse into subdirectories, following symlinks ‑R ‑‑dereference‑recursive
No descending into subdirectories ‑n ‑‑no‑recurse ‑n ‑‑norecurse
Add/remove directory from list of ignored dirs ‑‑[no‑]ignore‑dir ‑‑ignore‑dir
Don't respect ignore files (.gitignore, .ignore, etc) ‑‑no‑ignore ‑‑no‑ignore‑parent ‑‑no‑ignore‑vcs
Ignore files larger than a given size ‑‑max‑filesize
Specify files to search ‑‑include ‑g ‑‑glob ‑‑iglob
Ignore files/directories matching ‑‑ignore ‑‑exclude ‑‑exclude‑from ‑‑exclude‑dir ‑‑ignore‑file
Add filter for ignoring files ‑‑ignore‑file
Include only files of types that ack recognizes ‑k ‑‑known‑types
Follow symlinks ‑‑[no‑]follow ‑f ‑‑follow ‑L ‑‑follow
Don't follow links to other devices ‑‑one‑device ‑‑devices=skip
Include only files of a given type ‑‑type=X
Search all types of files ‑a ‑‑all‑types
Limit directory search depth ‑‑depth ‑‑max‑depth ‑‑maxdepth
Search binary files ‑‑binary
Treat files as binary ‑U ‑‑binary
Don't search in binary files ‑I
Treat binary files as if they were text ‑a ‑‑text ‑a ‑‑text
Search all text files ‑t ‑‑all‑text
Search all files ‑u ‑‑unrestricted ‑u ‑‑unrestricted
Skip rules found in VCS ignore files (.gitignore, .hgignore, etc) ‑U ‑‑skip‑vcs‑ignores
File type specification ack ag git-grep GNU grep rg
Create a filetype, replacing the previous specs ‑‑type‑set
Add specifications to an existing filetype ‑‑type‑add ‑‑type‑add
Remove a file type ‑‑type‑del ‑‑type‑clear
Display all known types ‑‑help‑types ‑‑list‑file‑types ‑‑type‑list
Miscellaneous ack ag git-grep GNU grep rg
Print all lines, whether matching or not ‑‑passthru ‑‑passthrough
Outputs a default ackrc for your customization to standard output ‑‑create‑ackrc
Dump information on which options are loaded ‑‑dump
Specify a configuration file to use ‑‑ackrc
Ignore environment variables and global configuration files ‑‑env
Ignore default definitions included with ack ‑‑ignore‑ack‑defaults
Treat standard input as a pipe ‑‑[no‑]filter
Search contents of compressed files (e.g. gzip) ‑z ‑‑search‑zip
Specify input file encoding ‑E ‑‑encoding