# Mac disk usage commands: a du, df and find cheat sheet

_Updated 2026-11-01_

> **Quick answer:** `du -hd 1 ~ | sort -hr | head -20` lists the 20 biggest folders in your home folder, biggest first. Run it again inside whichever folder is on top to drill down.


## Find the biggest folders

```
du -hd 1 ~ 2>/dev/null | sort -hr | head -20
du -hd 1 ~/Library 2>/dev/null | sort -hr | head -20
du -hd 1 ~/Library/Application\ Support 2>/dev/null | sort -hr | head -20
```

`-h` prints sizes people can read, `-d 1` goes one level deep, `sort -hr` puts the biggest first and `head -20` keeps the top twenty. On one test Mac the second command put `Developer` on top at 36 GB, then `Application Support` at 20 GB and `Caches` at 9.1 GB.


## Find the biggest files

```
find ~ -type f -size +500M -print 2>/dev/null
find ~ -type f -size +1G -print 2>/dev/null
ls -lhS ~/Downloads | head
```

The first two list files bigger than 500 MB and 1 GB. The last lists a folder's files with the biggest on top. Old installers and disk images often turn up in Downloads.


## Check free space

```
df -h /System/Volumes/Data
diskutil apfs list | grep -E "Capacity In Use|Capacity Not Allocated"
```

`df` counts in GiB, while macOS Settings counts in GB, so the numbers differ by about 7 percent for the same disk. See [what purgeable space is](/guides/what-is-purgeable-space-on-mac/) for the rest of why tools disagree.


## Measure one location

```
du -sh ~/Library/Caches
du -sh ~/.cache ~/.npm ~/.gradle ~/.cargo 2>/dev/null
sudo du -sh /Library/Caches /private/var/log /private/var/vm 2>/dev/null
sudo du -xhd 1 /System/Volumes/Data 2>/dev/null | sort -hr | head -15
```

`-s` prints one total per argument and `-x` stays on a single volume so nothing is counted twice. `sudo` is needed for system folders and asks for your password.


## Snapshots

```
tmutil listlocalsnapshots /
diskutil apfs listSnapshots /
```


## Make it faster or easier

- Run `ncdu ~` after `brew install ncdu` for an interactive browser inside Terminal.
- Protected folders print `Operation not permitted`. Give Terminal Full Disk Access in System Settings if you need to read them.
- Prefer a picture? A [disk visualizer](/guides/see-what-is-taking-up-space-on-mac/) draws the same numbers as a map.

Once you know what is big, see [what is inside System Data](/guides/find-whats-inside-system-data-mac/) for how to read the results, and [how to clear System Data safely](/guides/how-to-clear-system-data-on-mac/) for what to do next.

Get See Your Disk: [Mac App Store](https://apps.apple.com/us/app/clean-systemdata-seeyourdisk/id6817565741) · [GitHub](https://github.com/bikmeev/see-your-disk)

## Frequently asked questions

**What does 2>/dev/null do in these commands?**
It hides the error messages. Without it, du prints Operation not permitted for every folder macOS protects, which buries the useful lines.

**What is the difference between sort -h and sort -hr?**
sort -h sorts human-readable sizes such as 4.5G and 120M from small to large. Adding r reverses it, so the biggest come first.

**Do these commands change or delete anything?**
No. Every command on this page only reads sizes and names.

**Why does du show a different size than Finder?**
du reports the space actually used on disk. Finder can show a file's apparent size, which for sparse files such as Docker.raw is much larger.

## Related guides

- [How to view what is inside System Data on Mac: a Terminal audit](https://seeyourdisk.com/guides/find-whats-inside-system-data-mac/)
- [How to see what is taking up space on your Mac](https://seeyourdisk.com/guides/see-what-is-taking-up-space-on-mac/)
- [What is System Data on Mac, and why is it so big?](https://seeyourdisk.com/guides/what-is-system-data-on-mac/)
