Back to lessons

Apple Terminal

Find Which Folder Is Eating Disk Space

Disk space is low and the user needs to identify which project folder or cache is largest.

Command

du -sh ./* 2>/dev/null | sort -h

What changed

Nothing changes. The command calculates and sorts apparent disk usage.

Danger

safe

When to use it

Use in Projects, Downloads, Desktop, or cache directories to find big items quickly.

When not to use it

Do not run from the filesystem root expecting instant results. Start narrow.

Undo or recovery

No undo needed because this command is read-only.

Expected output

A human-readable sorted list such as 4.0K ./notes and 1.2G ./video-export.

demo script

Disposable terminal steps

  1. printf '%s\n' '4.0K ./notes' '850M ./node_modules' '1.2G ./video-export'
  2. printf '%s\n' '4.0K ./notes' '850M ./node_modules' '1.2G ./video-export' | sort -h

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ printf '%s\n' '4.0K ./notes' '850M ./node_modules' '1.2G ./video-export'
4.0K ./notes
850M ./node_modules
1.2G ./video-export
::exit-code::0
$ printf '%s\n' '4.0K ./notes' '850M ./node_modules' '1.2G ./video-export' | sort -h
4.0K ./notes
850M ./node_modules
1.2G ./video-export
::exit-code::0

YouTube Short

What ate my disk?

Use du for human-readable sizes, then sort numerically by size. Start in the folder you suspect.

LinkedIn hook

When your Mac is full, start with the biggest folders in the current directory.

Question: What is usually the biggest disk-space offender on your Mac?

experiments

A/B tests to run

Metric: watch_time

A: Lead with low disk space anxiety.

B: Lead with a practical cleanup workflow.