Back to commands

Linux Survival Basics

Read-only, can be slow

Find the Largest CI Logs

A CI job is slow or hard to inspect because some logs are unexpectedly large.

Command

find logs/ -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 use it for compressed logs when you need uncompressed size analysis.

Expected output

The 10 largest log files with byte counts.

System impact

Read-only, can be slow. Nothing changes. The command reports the largest log 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 log uploads are slow or a job output is unusually noisy.

When not to use it

Do not use it for compressed logs when you need uncompressed size analysis.

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:~$

$ find logs/ -type f -print

logs/unit.log
logs/integration.log
logs/build.log
logs/test.log

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

1200 logs/integration.log
130 logs/build.log
81 logs/test.log
6 logs/unit.log
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. find logs/ -type f -print
  2. find logs/ -type f -printf '%s %p\n' | sort -nr | head -10

next steps

Related commands

Linux Survival Basics Can be slow

Find the Files Eating Your Disk

The disk was full, but guessing at folders was the slow part.

find /var -type f -printf '%s %p\n' | sort -nr | head -20
Linux Survival Basics Can be slow

Show Big Files in Human Units

Byte counts are precise. Human units are faster under pressure.

find /var -type f -printf '%s %p\n' | sort -nr | head -10 | awk '{printf "%.1f MB %s\n", $1/1024/1024, $2}'
Linux Survival Basics Can be slow

Count Source Files by Extension

A quick extension count can show whether expected content made it into the source tree.

find source -type f -printf '%f\n' | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr
Linux Survival Basics Can be slow

Count Failures by Test File

Turn noisy test logs into a ranked failure list.

grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | 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
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: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.