LAB-DISK-01 - Disk Usage (df and du)
Disk Usage (df and du)
Use df and du to understand where disk space is going before deciding what to clean up.
- Use df to see overall filesystem usage.
- Use du to identify which directories are taking space.
- Do not delete files just because they are large. Confirm what they are and whether they are safe to remove.
Part A: The Field Guide
Disk-space problems are easy to mishandle if you jump straight to deleting things.
The safer sequence is:
- check which filesystem is full
- inspect which directories are large
- confirm what the large data actually is
- only then decide what action is appropriate
df and du answer different parts of that sequence.
Useful Distinction
df shows filesystem-level usage. du shows how space is distributed across directories or files.
Part B: The Drill Deck
Terminal required: this lab is diagnosis-first.
G Guided Step by step - type exactly this and compare the result >
Exercise G1: Check overall filesystem usage
- Run
df -h - Identify the filesystem with the highest use percentage
- Notice the mount point associated with it
Exercise G2: Inspect a directory tree
- Run
du -sh ~/* 2>/dev/null | sort -h - Notice which directories in your home area are largest
- Remember that large does not automatically mean disposable
Exercise G3: Compare the two views
Explain:
- what
df -htold you - what
du -shtold you - why you often need both views together
S Solo Task described, hints available - figure it out >
Exercise S1: Narrow the search safely
Pick one larger directory from your home area and run a more focused check such as:
du -sh ~/Downloads/* 2>/dev/null | sort -h
Then decide which entries deserve more investigation, not immediate deletion.
Exercise S2: Explain a safer cleanup mindset
Describe why deleting logs, caches, or old downloads may each require different judgment.
M Mission Real scenario - no hints, combine multiple skills >
Mission M1: Build a simple disk-space investigation flow
Write out the sequence you would use when a system reports low disk space:
- start with df
- narrow with du
- confirm what the data is
- only then choose a cleanup step
If that sequence feels obvious, the lab has done its job.