$ grep
Print lines that match patterns
DOCUMENTEDSearch & textUbuntu 24.04 LTS baseline
Synopsis
grep [OPTION]... PATTERNS [FILE]...
What it does
- `grep` searches input for matching patterns and normally prints matching lines.
- Patterns are commonly quoted so the shell does not interpret special characters intended for grep.
Examples
Find a word in a file
grep 'error' application.logSearch recursively
grep -R 'Listen' /etc/nginx/Ignore case
grep -i 'warning' file.txtImportant details
These examples are intentionally conservative. Command behavior can still depend on filesystem state, permissions, locale, shell, installed package version, and other system configuration.
For exact option semantics, the linked authoritative documentation is the source of truth.