Hosting Operations
Read-only, can be slowSummarize Test Counts from Reports
You need to know whether one test failed, many tests failed, or the whole suite crashed.
Command
grep -RhoE 'tests="[0-9]+"|failures="[0-9]+"|errors="[0-9]+"|skipped="[0-9]+"' artifacts/test/*.xml | sort | uniq -c
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 use this for exact aggregation across nested XML suites without a real parser.
Expected output
Counts of test, failure, error, and skipped attributes.
System impact
Read-only, can be slow. Nothing changes. The shell prints repeated test count attributes.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use before diving into individual failures to understand test-suite scope.
When not to use it
Do not use this for exact aggregation across nested XML suites without a real parser.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ cd /work/ci-artifacts && grep -RhoE 'tests="[0-9]+"|failures="[0-9]+"|errors="[0-9]+"|skipped="[0-9]+"' artifacts/test/*.xml
tests="4"
failures="1"
errors="0"
skipped="1"
$ cd /work/ci-artifacts && grep -RhoE 'tests="[0-9]+"|failures="[0-9]+"|errors="[0-9]+"|skipped="[0-9]+"' artifacts/test/*.xml | sort | uniq -c
1 errors="0"
1 failures="1"
1 skipped="1"
1 tests="4"
$ cd /work/ci-artifacts && sed -n '1,20p' artifacts/test/junit.xml
<testsuite name="api" tests="4" failures="1" errors="0" skipped="1">
<testcase classname="tests.test_api" name="test_health"/>
<testcase classname="tests.test_api" name="test_create_user">
<failure message="expected 201 got 500">AssertionError</failure>
</testcase>
<testcase classname="tests.test_billing" name="test_invoice"/>
<testcase classname="tests.test_slow" name="test_report"><skipped message="slow"/></testcase>
</testsuite>
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
cd /lab/ci-artifacts && grep -RhoE 'tests="[0-9]+"|failures="[0-9]+"|errors="[0-9]+"|skipped="[0-9]+"' artifacts/test/*.xmlcd /lab/ci-artifacts && grep -RhoE 'tests="[0-9]+"|failures="[0-9]+"|errors="[0-9]+"|skipped="[0-9]+"' artifacts/test/*.xml | sort | uniq -ccd /lab/ci-artifacts && sed -n '1,20p' artifacts/test/junit.xml
next steps
Related commands
List Failed Tests from JUnit XML
The XML report already knows which tests failed.
grep -RIn '<failure\|<error' artifacts/test/*.xml
Count Request IDs in Error Lines
Repeated request IDs can connect separate error lines to one failing path.
grep -Ei 'error|timeout|fatal|exception' fixtures/incidents/app.log | awk '{for (i=1;i<=NF;i++) if ($i ~ /^request_id=/) print $i}' | sort | uniq -c | sort -nr
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
Find Duplicate Page Titles
Duplicate titles make a static site harder to scan in search results and browser tabs.
grep -Rho --include='*.html' '<title>[^<]*</title>' public | sed 's#<title>##;s#</title>##' | sort | uniq -c | sort -nr
Summarize Cache File Ages
Cache cleanup is safer when you know whether files are stale or still active.
find /lab/disk-inode-cleanup/var/cache/app -xdev -type f -printf '%TY-%Tm-%Td\n' | sort | uniq -c
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.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.