ripgrep Basics/Count matching lines globally

Suppress file names and count matches across stdin or a small target.

Section: File discovery and listing

Count matching lines globally

bash
bash
rg -c 'ERROR' app.log
Explanation

For multi-file totals, pair with shell tools such as `awk` or use JSON output for scripting.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing File discovery and listing
Count matches per file
Show how many matches exist in each file.
OpenIn sheetbashsame section
List only file names with matches
Return matching file paths without printing the matching lines.
OpenIn sheetbashsame section
List files without matches
Find files that do not contain a pattern.
OpenIn sheetbashsame section
Show available built-in file types
Print ripgrep's known type definitions.
OpenIn sheetbashsame section
Search logs from another command
Filter live or recent command output with rg.
OpenIn sheetbash2 tag match
Search recursively in the current directory
Search for a pattern using ripgrep's recursive defaults.
OpenIn sheetbash1 tag match