du

Find out how much space a folder takes

What it does

du (disk usage) adds up the size of files and folders. With no flags it prints every folder inside, so you almost always type -sh: -s for one line with the total, -h for readable units.

du -sh * shows the size of each item in the current folder, and with | sort -h sorts them from smallest to largest, so the heaviest end up at the bottom. * skips hidden files. System folders need sudo, or some files are not counted.

Syntax

du -sh <folder>
du -sh * | sort -h

Examples

Related commands

Practise · All commands