Back to commands

Hosting Operations

Read-only, can be slow

Find the Largest CI Artifacts

CI upload, cache, or packaging steps are slow or failing, and oversized artifacts may be the cause.

Command

find artifacts -type f -printf '%s %p\n' | sort -nr | head -10

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 delete artifacts from this output alone; confirm which files are required.

Expected output

The ten largest artifact files with byte sizes and paths.

System impact

Read-only, can be slow. Nothing changes. The shell prints the largest artifact files.

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

Recovery / rollback: no state is changed.

When to use it

Use when artifact upload, cache restore, package creation, or disk usage looks suspicious.

When not to use it

Do not delete artifacts from this output alone; confirm which files are required.

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 && du -sh artifacts/*

12K	artifacts/build
12K	artifacts/coverage
20K	artifacts/dist
12K	artifacts/test

$ cd /work/ci-artifacts && find artifacts -type f -printf '%s %p\n' | sort -nr | head -10

831488 artifacts/dist/assets/vendor.js
250880 artifacts/dist/assets/main.js
450 artifacts/test/junit.xml
338 artifacts/test/pytest.log
139 artifacts/build/webpack.log
137 artifacts/build/app-build.log
131 artifacts/coverage/coverage-summary.txt
87 artifacts/coverage/coverage-summary.json
77 artifacts/dist/index.html

$ cd /work/ci-artifacts && find artifacts -type f -printf '%s %p\n' | sort -nr | awk 'NR<=5 {printf "%.1f KB %s\n", $1/1024, $2}'

812.0 KB artifacts/dist/assets/vendor.js
245.0 KB artifacts/dist/assets/main.js
0.4 KB artifacts/test/junit.xml
0.3 KB artifacts/test/pytest.log
0.1 KB artifacts/build/webpack.log
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. cd /lab/ci-artifacts && du -sh artifacts/*
  2. cd /lab/ci-artifacts && find artifacts -type f -printf '%s %p\n' | sort -nr | head -10
  3. cd /lab/ci-artifacts && find artifacts -type f -printf '%s %p\n' | sort -nr | awk 'NR<=5 {printf "%.1f KB %s\n", $1/1024, $2}'

next steps

Related commands

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
Hosting Operations Can be slow

List Largest Files in a Backup

Large backup files are where storage surprises usually start.

find backup -type f -printf '%s %p\n' | sort -nr | head
Hosting Operations Can be slow

Find the Newest Build Logs First

The failing file is usually one of the newest artifacts.

find artifacts logs -type f \( -name '*.log' -o -name '*.txt' \) -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r | head
Hosting Operations Can be slow

Find Directories Burning Inodes

Inode cleanup starts by finding the directory with too many files.

find /lab/disk-inode-cleanup/var/cache/app -xdev -type f -printf '%h\n' | sort | uniq -c | sort -nr | head
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
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.