Files
tldr/pages/common/rg.md
Wyatt Childers f2b054d0e1 rg: improved fixed string suggestion (#5995)
It's better to include a `--` prior to the search string so that strings
starting with `--` (e.g. `--foo`) aren't processed as cli options.

https://github.com/BurntSushi/ripgrep/discussions/1560#discussioncomment-6346
2021-05-19 11:19:10 -04:00

38 lines
1.0 KiB
Markdown

# rg
> Ripgrep is a recursive line-oriented CLI search tool.
> Aims to be a faster alternative to `grep`.
> More information: <https://github.com/BurntSushi/ripgrep>.
- Recursively search the current directory for a regular expression:
`rg {{regular_expression}}`
- Search for regular expressions including all .gitignored and hidden files:
`rg --no-ignore --hidden {{regular_expression}}`
- Search for a regular expression only in a certain filetype (e.g., html, css, etc.):
`rg --type {{filetype}} {{regular_expression}}`
- Search for a regular expression only in a subset of directories:
`rg {{regular_expression}} {{set_of_subdirs}}`
- Search for a regular expression in files matching a glob (e.g., `README.*`):
`rg {{regular_expression}} --glob {{glob}}`
- Only list matched files (useful when piping to other commands):
`rg --files-with-matches {{regular_expression}}`
- Show lines that do not match the given regular expression:
`rg --invert-match {{regular_expression}}`
- Search a literal string pattern:
`rg --fixed-strings -- {{string}}`