Ripgrep is a fast search tool. The command line syntax is
rg [expression] [path]. There is an introductory guide in the repo.
The expression is a Rust Regex. To be safe you should wrap the expression in quotes,
", though for simple queries you can omit them. For example, if you are searching for content containing
^[ in zsh:
rg ^[ ./ # -> zsh: bad pattern: ^[ rg '^[' ./ # -> regex parse error: ... rg \^\[ ./ # -> regex parse error: ... rg '\^\[' ./ # -> success
--files-with-matchesonly show file paths
Print the paths with at least one match and suppress match contents. This overrides --files-without-match.
Suppress all error messages related to opening and reading files. Error messages related to the syntax of the pattern given are still shown. This flag can be disabled with the --messages flag.
rg -l --no-messages [query] [path]will give you a simple list of file paths whose contents contain the query.
One cool thing you can do with this command is open files in a text editor. For example, to open the file containing the function
vim $(rg -l 'function doSomething\(' ./)