df system
your disk is full and you're about to find out the hard way.
The df man page is 350 lines long. You need one command and about two seconds.
You ran out of disk space. You didn’t know until something crashed. A log filled up. A database stopped writing. A deploy failed with a cryptic error. You panicked. You opened the file manager, right-clicked the drive, clicked “Properties,” waited for the little pie chart to render, and saw a red sliver labeled “23 KB free.” You stared at it. The pie chart didn’t help you fix anything. It just confirmed you were screwed.
On a Mac, you clicked the Apple menu, “About This Mac,” “Storage,” and then waited approximately eleven years for macOS to calculate how much space “System Data” is using. Spoiler: it’s a lot. It’s always a lot. Apple has never explained what “System Data” is because even they don’t know.
On Windows, you opened “This PC,” stared at those horizontal bars under each drive, and noticed your C: drive bar was red. You right-clicked it. You selected “Properties.” You looked at the pie chart. It told you nothing actionable. You clicked “Disk Cleanup.” It found 47MB of temporary files. Your drive is 500GB full. That didn’t help.
One command would have told you everything in half a second.
Unless you’re running Windows then wtf none of this applies to you. But hey, come to the dark side, go install WSL2 and you can follow along. We’ll wait. Impatiently.
If you’re lazy like me (all sysadmins are!) then click here for the df cheat sheet.
Show me all the disk space (the command you want)
df -h
That’s it. Every mounted filesystem, how big it is, how much is used, how much is free, and the percentage used. In human-readable units.
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 234G 187G 35G 85% /
/dev/sdb1 932G 412G 473G 47% /data
tmpfs 7.8G 1.2M 7.8G 1% /dev/shm
/dev/sdc1 50G 49G 824M 99% /var/log
That last line? That’s your problem. /var/log is 99% full. Now you know exactly where to look. No pie chart. No “System Data” mystery blob. No waiting for macOS to finish thinking about it.
Show filesystem types too
df -hT
Adds a column showing the filesystem type — ext4, xfs, tmpfs, nfs, whatever.
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 234G 187G 35G 85% /
/dev/sdb1 xfs 932G 412G 473G 47% /data
tmpfs tmpfs 7.8G 1.2M 7.8G 1% /dev/shm
192.168.1.5:/ nfs4 2.0T 1.4T 600G 70% /mnt/nas
Useful when you’re wondering “wait, is this a local disk or an NFS mount?” The answer is in the Type column. You didn’t have to Google it.
Check a specific path
df -h /var/log
Shows only the filesystem that contains /var/log. When you have twenty filesystems mounted and you only care about one.
df -h /home
“How much space does my home directory’s filesystem have?” Answered. In one second. Without opening anything.
Filter out the noise
Your df output is probably cluttered with tmpfs, devtmpfs, squashfs snap loopback mounts, and other garbage you don’t care about. Clean it up:
df -h -x tmpfs -x devtmpfs -x squashfs
Excludes those filesystem types. Now you only see actual disks. If you’re on Ubuntu with Snap packages installed, this is borderline mandatory because Snap creates a loopback mount for every single snap, and df will show you thirty /dev/loop entries that mean nothing.
Or filter to only show specific types:
df -hT -t ext4 -t xfs
Only show ext4 and xfs filesystems. Real disks. No noise.
Inodes (when you’re out of space but you’re not out of space)
Here’s a fun one. Your disk says 50% free. But you still can’t create files. Error: “No space left on device.” What the hell?
You’re out of inodes. Every file and directory uses one inode. If you have millions of tiny files, you can exhaust inodes before you exhaust disk space.
df -ih
Shows inode usage instead of block usage. If the IUse% column is at 100%, that’s your problem.
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 15M 14M 956K 94% /
This happens more often than you’d think — mail servers, cache directories, and anything that creates one file per request will eat inodes alive. Your GUI file manager will never tell you about this. It doesn’t even know inodes exist.
Pair it with du (where is all the space going?)
df tells you which filesystem is full. du tells you what’s filling it.
Check a directory’s total size
du -sh /var/log
4.7G /var/log
One number. Total size of the directory and everything in it. Human-readable.
Find the biggest subdirectories
du -sh /var/log/* | sort -rh | head -10
2.1G /var/log/journal
1.8G /var/log/nginx
412M /var/log/syslog.1
198M /var/log/auth.log.1
47M /var/log/kern.log
There it is. journal and nginx logs are eating 4GB. Now you know what to clean up. This took two seconds. No TreeSize. No WinDirTree. No Disk Inventory X. No grandview analyzer. Just a command.
Find big files anywhere
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null
Every file over 100MB on the entire system. The 2>/dev/null suppresses permission errors so you don’t get fifty “Permission denied” lines cluttering your output.
The flags that actually matter
| Flag | What it does |
|---|---|
-h |
Human-readable sizes (K, M, G, T). |
-H |
Human-readable with powers of 1000 instead of 1024. |
-T |
Show filesystem type column. |
-i |
Show inode usage instead of block usage. |
-t TYPE |
Only show filesystems of this type (e.g., ext4, xfs). |
-x TYPE |
Exclude filesystems of this type (e.g., tmpfs, squashfs). |
--total |
Add a total row at the bottom. |
And for du (its partner in crime):
| Flag | What it does |
|---|---|
-s |
Summary — total only, don’t list every subdirectory. |
-h |
Human-readable sizes. |
-d N |
Max depth of N levels. |
--max-depth=1 |
Same as -d 1. Show only immediate children. |
“But I can just right-click—”
No.
“I right-click the drive and check Properties.” And you get a pie chart. A blue and pink pie chart. It shows you used space and free space. It does not show you which directory is using 200GB. It does not show you that /var/log/nginx/access.log has been growing unchecked for fourteen months. It just shows you a circle with colors and you think “hm, it’s getting full.” That’s not diagnostics. That’s a screensaver.
“macOS Storage Management shows me categories.” It shows you “System Data: 87GB” and offers no explanation. It shows you “Other: 34GB.” What’s “Other”? Files that Apple’s categorization algorithm couldn’t classify. That’s not a category. That’s a shrug. du -sh /* | sort -rh doesn’t shrug. It tells you exactly what’s where.
“I use WinDirTree / TreeSize / Disk Inventory X.” You installed a dedicated application to answer a question that du -sh * | sort -rh answers in one line. TreeSize is 15MB. It scans your entire drive with a progress bar. It builds a treemap visualization. It looks impressive. It took thirty seconds. du took two.
“I have a monitoring dashboard for disk space.” Good. You should. But when you’re SSH’d into a server at 2 AM because that dashboard paged you, you’re not opening Grafana on your phone. You’re typing df -h and du -sh /var/* | sort -rh and fixing it. The dashboard told you there was a problem. The command line tells you how to fix it.
“Disk Cleanup will free up space.” Disk Cleanup is Windows’ way of saying “I’ll delete 47MB of temporary files and pretend that helped.” Your drive has 12GB of Windows Update cache, 8GB of crash dumps, and a pagefile.sys that’s mysteriously larger than your RAM. Disk Cleanup won’t touch any of those unless you click “Clean up system files” and even then, it’s cautious. du and rm don’t have feelings. They just work.
df cheat sheet
You made it. Or you skipped straight here. Either way, no judgment. Copy and paste these. Pin them. Tattoo them on your forearm. Whatever works.
| What you’re doing | Command |
|---|---|
| Show all disk space | df -h |
| Show with filesystem types | df -hT |
| Check specific path | df -h /var/log |
| Check inode usage | df -ih |
| Only real disks (skip tmpfs/snap) | df -h -x tmpfs -x devtmpfs -x squashfs |
| Only ext4/xfs filesystems | df -hT -t ext4 -t xfs |
| Total size of a directory | du -sh /path/ |
| Biggest subdirectories | du -sh /path/* | sort -rh | head -10 |
| Find files over 100MB | find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null |
The first response:
df -htells you which disk is full.du -sh /path/* | sort -rh | head -10tells you why. That’s the entire diagnostic workflow.