Back to commands

Hosting Operations

Read-only, can be slow

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

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 it as proof of failure cause; open the relevant log after locating it.

Expected output

A date-sorted list of recent .log and .txt files.

System impact

Read-only, can be slow. Nothing changes. The shell prints the newest matching log files first.

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

Recovery / rollback: no state is changed.

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.

Explanation-only example

Illustrated output, not a live lab run

This example is intentionally illustrative. It shows the command shape without killing real processes or changing your machine.

demo@lab:~$

$ cd /work/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

$ cd /work/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

$ cd /work/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
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. cd /lab/ci-artifacts && find artifacts logs -type f | sort
  2. 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
  3. cd /lab/ci-artifacts && sed -n '1,80p' artifacts/build/app-build.log

next steps

Related commands

Hosting Operations Can be slow

List Restore Points Before a Drill

A restore drill starts by proving which backups actually exist.

cd restore-dr && find backups -maxdepth 2 -type f -name MANIFEST.txt -printf '%TY-%Tm-%Td %TH:%TM %h\n' | sort -r
Hosting Operations Can be slow

List Newest Build Artifacts

Confirm what your pipeline actually produced before you deploy it.

find artifacts/ -type f -printf '%TY-%Tm-%Td %TH:%TM %10s %p\n' | sort | tail -20
Hosting Operations Can be slow

Show Release Directory Ages

See your newest release directories without opening a dashboard.

find releases/ -mindepth 1 -maxdepth 1 -type d -printf '%T@ %TY-%Tm-%Td %TH:%TM %p\n' | sort -nr | head -10 | cut -d' ' -f2-
Hosting Operations Can be slow

List Newest Source Files Before Backup

Before trusting a backup, know which files changed most recently.

find source -type f -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort
Hosting Operations Can be slow

Rank Old Cleanup Candidates by Size

The oldest file is not always the file that buys back meaningful space.

find /lab/disk-inode-cleanup/var -xdev -type f -mtime +7 -printf '%s %TY-%Tm-%Td %p\n' | sort -nr | head
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.

  • lpic1:103-gnu-unix-commands
  • lpic1:104-filesystems-permissions-fhs
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • lfcs:storage
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • linuxplus:system-management
  • risk:read-only

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.