grep

Search for a pattern inside a file

grep prints lines matching a pattern. grep 'error' app.log finds all lines with 'error' (case-sensitive). Wrap patterns in single quotes to avoid shell interpretation.

Example

$ grep 'ERROR' /var/log/app.log
2024-01-15 14:23:45 ERROR Failed to connect
Tip: Type it yourself in the terminal below - reading is not the same as doing.