Hosting Operations
Find the Newest Build Logs First
A CI job produced several logs and reports, and you need to quickly locate the most recent build output before reading everything.
Command
find artifacts logs -type f \( -name '*.log' -o -name '*.txt' \) -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r | head
What changed
Nothing changes. The shell prints the newest matching log files first.
Danger
safe
When to use it
Use when a build leaves many logs and you need the most likely failure source.
When not to use it
Do not use it as proof of failure cause; open the relevant log after locating it.
Undo or recovery
No undo needed because this command is read-only.
Expected output
A date-sorted list of recent .log and .txt files.
demo script
Disposable terminal steps
cd /lab/ci-artifacts && find artifacts logs -type f | sortcd /lab/ci-artifacts && find artifacts logs -type f \( -name '*.log' -o -name '*.txt' \) -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r | headcd /lab/ci-artifacts && sed -n '1,80p' artifacts/build/app-build.log
simulated output
What it looks like
::fixture-ready::
$ cd /lab/ci-artifacts && find artifacts logs -type f | sort
artifacts/build/app-build.log
artifacts/build/webpack.log
artifacts/coverage/coverage-summary.json
artifacts/coverage/coverage-summary.txt
artifacts/dist/assets/main.js
artifacts/dist/assets/vendor.js
artifacts/dist/index.html
artifacts/test/junit.xml
artifacts/test/pytest.log
logs/cache.log
logs/deploy.log
::exit-code::0
$ cd /lab/ci-artifacts && find artifacts logs -type f \( -name '*.log' -o -name '*.txt' \) -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r | head
2026-06-25 10:07 logs/cache.log
2026-06-25 10:06 logs/deploy.log
2026-06-25 10:05 artifacts/coverage/coverage-summary.txt
2026-06-25 10:04 artifacts/build/app-build.log
2026-06-25 10:03 artifacts/build/webpack.log
2026-06-25 10:01 artifacts/test/pytest.log
::exit-code::0
$ cd /lab/ci-artifacts && sed -n '1,80p' artifacts/build/app-build.log
Starting build
Resolving dependencies
Compiling app
ERROR in src/server.ts:42: missing export createServer
Build failed with exit code 1
::exit-code::0
YouTube Short
Start with the newest CI log.
When CI drops a pile of artifacts, sort logs by time first. It narrows the search before you start reading.
LinkedIn hook
The failing file is usually one of the newest artifacts.
Question: When CI fails, do you inspect logs by timestamp or by guesswork?
experiments
A/B tests to run
Metric: short_click_through_rate
A: The failing file is usually one of the newest artifacts.
B: Find the newest CI logs first.