du -sh <dir>Total size of a directory, human-readable.
Example
du -sh /var/logEstimates how much space files and directories use — find what is filling a disk.
sudo apt install coreutilsdu -sh <dir>Total size of a directory, human-readable.
Example
du -sh /var/logdu -sh *Size of each item in the current directory.
du -sh .[!.]* *Includes hidden files and directories.
du -h --max-depth=1 <dir>One level of subdirectories (on macOS use -d 1).
Example
du -h --max-depth=1 /homedu -ah <dir>Lists files as well as directories.
Example
du -ah /etc/nginxdu -c <files>Adds a grand total.
Example
du -ch *.logdu -sh * | sort -hSorted smallest to largest.
du -ah <dir> 2>/dev/null | sort -rh | head -n 20The 20 largest files and directories.
Example
du -ah / 2>/dev/null | sort -rh | head -n 20du -xh --max-depth=1 / 2>/dev/null | sort -hStays on one file system (-x) so mounted volumes are not counted.
du -sh --exclude=<pattern> <dir>Leaves out matching paths.
Example
du -sh --exclude=node_modules ~/projectsdu --apparent-size -sh <file>Shows the logical size, which differs from disk usage for sparse files.
Example
du --apparent-size -sh disk.img