1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-09 00:45:26 +02:00
tldr/pages/common/rg.md

38 lines
1 KiB
Markdown
Raw Normal View History

# rg
2016-11-02 21:42:23 -06:00
> Ripgrep, a recursive line-oriented search tool.
> Aims to be a faster alternative to `grep`.
> More information: <https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md>.
2016-11-02 21:42:23 -06:00
- Recursively search current directory for a pattern (regular expression):
2016-11-02 21:42:23 -06:00
`rg {{pattern}}`
2016-11-02 21:42:23 -06:00
- Recursively search for a pattern in a file or directory:
2016-11-02 21:42:23 -06:00
2025-05-03 17:44:39 +02:00
`rg {{pattern}} {{path/to/file_or_directory}}`
2016-11-02 21:42:23 -06:00
- Include hidden files and entries listed in `.gitignore`:
2016-11-02 21:42:23 -06:00
`rg {{[-.|--hidden]}} --no-ignore {{pattern}}`
2016-11-02 21:42:23 -06:00
- Only search the files whose names match the glob pattern(s) (e.g. `README.*`):
2016-11-02 21:42:23 -06:00
`rg {{pattern}} {{[-g|--glob]}} {{filename_glob_pattern}}`
2018-09-06 09:46:53 -04:00
- Recursively list filenames in the current directory that match a pattern:
`rg --files | rg {{pattern}}`
2019-11-04 10:54:16 +01:00
- Only list matched files (useful when piping to other commands):
2018-09-06 09:46:53 -04:00
`rg {{[-l|--files-with-matches]}} {{pattern}}`
2018-12-08 19:01:13 +07:00
- Show lines that do not match the pattern:
2018-12-08 19:01:13 +07:00
`rg {{[-v|--invert-match]}} {{pattern}}`
- Search for a literal string pattern:
`rg {{[-F|--fixed-strings]}} -- {{string}}`