The du command
estimate file space usage 9 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.
Options in the examples
-h, --human-readable- print sizes in human readable format (e.g., 1K 234M 2G)
-s, --summarize- display only a total for each argument
-d, --max-depth=N- print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is…
Examples
du -hCurrent directory, human-readable
du -shSummary of current directory
du -sh *Size of each item in current dir
du -sh /var/*Size of each subdirectory
du -h --max-depth=1 /varOne level deep
du -sh /var/* | sort -rh | head -10
du -sh /var/log/*Which directories are biggest?
du -sh /* 2>/dev/null | sort -rh | headTop-level space hogs, sorted
sudo du -sh /var/log/*Where are the big files…?