Skip to main content

A fast command-line search tool. ripgrep recursively searches directories for a regex pattern.

# To recursively search the current directory for a regex pattern:
rg <pattern>

# To search for pattern including all .gitignored and hidden files:
rg -uu <pattern>

# To search for a pattern only in a certain filetype (e.g., html, css, etc.):
rg -t <filetype> <pattern>

# To search for a pattern only in a subset of directories:
rg <pattern> <set_of_subdirs>

# To search for a pattern in files matching a glob (e.g., 'README.*'):
rg <pattern> -g <glob>

# To only list matched files -- useful when piping to other commands:
rg --files-with-matches <pattern>

# To show lines that do not match the given pattern:
rg --invert-match <pattern>