Find the line that matters
A log has thousands of lines; you need the three errors. grep prints lines matching a pattern — a plain word or a regular expression — and it's the tool you'll use most when debugging servers.
grep's options
grep ERROR app.log
grep -i error app.log
grep -c -i error app.log
grep -n WARN app.log
grep -v INFO app.log
grep -E "ERROR|WARN" app.log
grep -o "order=[0-9]*" app.log
grep -E "[0-9]{4}ms" app.log
grep -r "console" ~/src- . any character, * repeat, + one or more (with -E)
- ^ start of line, $ end of line
- [abc] one of, [^abc] none of, \b word boundary