How can I find the biggest folders on my VPS?
What this is
Mapping where the disk went. This is the tool half; if the disk is actually full and things are breaking, the disk-full guide is the emergency version with the cleanup advice, this page is the measurement skill on its own.
du, the built-in answer
du -xhd1 / | sort -h
Sizes of every top-level directory, sorted, biggest last. The flags earn their keep: -x stays on one filesystem, -h human units, -d1 one level deep. Then drill down, re-run against the biggest entry (du -xhd1 /var | sort -h), and again, three or four hops finds any hog. Impatient variant: du -xh / 2>/dev/null | sort -h | tail -30 dumps the 30 biggest directories at any depth in one go.
ncdu, the tool worth installing
apt install ncdu
ncdu -x /
The same data as an interactive browser: arrow into directories, sizes always sorted, d deletes (carefully), q quits. One scan, then you explore instantly instead of re-running du per level. For a Windows VPS the equivalent is WinDirStat.
When the numbers don't add up
Two classic cases where df says full but du can't find it:
- Deleted-but-open files: a deleted log a running service still holds open keeps consuming space invisibly,
lsof +L1lists them; restarting the holder releases the space (the disk-full guide covers it). - Out of inodes, not bytes: millions of tiny files, du's size view won't show it,
du --inodesand its own guide.
Still need help?
You can open a support ticket. So we can help on the first reply, it's worth mentioning:
- the VPS hostname or IP,
- the
duor ncdu output for the directory in question.
Related questions
- "How do I see which folders use the most disk space?"
- "How do I find the largest files on my VPS?"
- "What's the ncdu command and why is it better than du?"
- "df says the disk is full but du can't find the space, why?"