Skip to content
Clairos Learn

Files and paths · Lesson 5 of 36 · 8 minutes

Directory size map

Combine find, du, and df to reason about storage safely.

Mastery 0/3Run itExplain itApply it
learner@clairosSimulated Linux lab
learner@clairos:~ $
↑ history · Tab complete · Ctrl+C cancel · Esc, Tab to leaveExit 0

Understand the pattern

Operators should measure before deleting or moving data.

find
Search directory trees by criteria rather than relying on one shallow listing.

Quote wildcard patterns so find receives them instead of the shell expanding them first.

du
Estimate usage attributed to files or directories; compare it with filesystem capacity when investigating storage.

du describes file usage, whereas df describes filesystem capacity.

df
Inspect the virtual filesystem capacity report. Real systems can run out of space or inodes independently.

Available space is a snapshot, not a guarantee that a later write will succeed.

Worked example and expected result
$ find /home/learner -name txt
/home/learner/archive/old-note.txt
/home/learner/backups/manifest.txt
/home/learner/data/baseline.txt
/home/learner/data/checksums.txt
/home/learner/data/package-owners.txt
/home/learner/data/ports.txt
/home/learner/data/users-a.txt
/home/learner/data/users-b.txt
/home/learner/notes/todo.txt
/home/learner/projects/hello.txt
/home/learner/README.txt

Exit status: 0. The command completed successfully in the training fixture.

$ du -sh /home/learner
3K	/home/learner

Exit status: 0. The command completed successfully in the training fixture.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
lab-root         20G  6.4G   14G  32% /
lab-logs        2.0G  180M  1.9G   9% /var/log

Exit status: 0. The command completed successfully in the training fixture.

Try a variation

Repeat this workflow in the sandbox with a different scratch filename. Keep the system fixtures unchanged and compare the observed output with your expectation before moving on.

Explain it

In “Directory size map”, which interpretation is safe?

Apply it elsewhere

Before adapting the du workflow from “Directory size map” to another server, what should you do?

Keep the momentum.

Complete the lab, then explain and apply the pattern.

Next: Symbolic linksTry an incident drill

Anonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.

Keep learning

  1. 01Find filesSearch the simulated filesystem by root and filename pattern.Practice
  2. 02Symbolic linksCreate and inspect a simulated symbolic link.Practice
  3. 03Archive basicsCreate and list a simulated tar archive.Practice