Search with context in ripgrep
Show 3 lines of context around matches in Go files
rg 'panic' -C3 --glob '*.go'
- tool
- grep15 commands
More grep commands
-
rg 'secret_key' --hidden --no-ignoreAlso search hidden files and files ignored by .gitignore
-
rg 'old_value' --replace 'new_value' --passthru config.yamlShow the whole file with the replacement applied, without writing to it
-
rg 'error' /var/log/ --stats 2>&1 | tail -5Show the number of matches, searched files and elapsed time
-
grep -a 'password' /proc/<pid>/mem 2>/dev/null | strings | head -20Treat binary data as text (-a), here to search process memory
-
grep -E '(ERROR|WARN|CRIT)' app.log | tail -50Show the last 50 lines that contain ERROR, WARN or CRIT