Low Orbit Flux Logo 2 F

Linux Command - du

The Linux du command is used to show the disk space usage of files and directories. It doesn’t follow symbolic links by default.

Most common and useful commands:

Show sizes for all files and dirs in current dir in human readable format and sort numerically by human readable format:

du -sh * sort -h

Human readable total usage for each file and dir in current dir:

du -sh *

Other useful examples:

Recursively check usage of dirs in current directory:

du

Human readable total for current dir:

du -sh

Only 2 levels deep:

du -d 2

Show sizes for all files and dirs in current dir in k and sort numerically:

du -sk * sort -n

Common arguments:

-a all files not just dirs
-c show total
-s summarize, just show total
-d levels deep
-h human readable
-k units in k
-m units in m
-L follow all symbolic links
–time show modification times
-x skip dirs on other file systems