Back to commands

Hosting Operations

Read-only, can be slow

Show Context Around the First Error

A log contains a clear error line, but the useful cause may be several lines above or below it.

Command

grep -RInC 3 -m 1 'ERROR' artifacts logs

Before you run this

System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.

When not to use it: Do not stop at the first match if the job continued and later failed for another reason.

Expected output

A small context block around the first ERROR match.

System impact

Read-only, can be slow. Nothing changes. grep prints the first ERROR match with nearby lines.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

When to use it

Use after finding which logs contain error markers.

When not to use it

Do not stop at the first match if the job continued and later failed for another reason.

next steps

Related commands

Hosting Operations Can be slow

Scan Every CI Log for Error Lines

One grep pass can turn a log pile into a failure list.

grep -RInE 'error|failed|failure|exception|traceback' artifacts logs | head -50
Hosting Operations Can be slow

Detect Secret Leak Markers in Artifacts

Artifacts are public more often than you think.

grep -RInE 'AWS_ACCESS_KEY|SECRET|TOKEN|PRIVATE KEY|PASSWORD' artifacts logs | head -50
Hosting Operations Can be slow

Find Coverage Regression Lines

Coverage failures usually say the threshold out loud.

grep -RInE 'coverage|threshold|minimum|below' artifacts logs
Hosting Operations Can be slow

Find Tests That Passed After Rerun

A green retry can still hide a flaky test.

grep -RInE 'rerun|retry|flaky|passed on retry|failed attempt' artifacts logs
Hosting Operations Can be slow

Tail the Failing CI Lines

Skip the full CI log and jump straight to lines that usually explain the failure.

grep -RInE 'error|failed|exception|traceback|fatal' logs/ | tail -50
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.