Linux - Disk Usage

15 Jun 25

$ du -hs /path/to/directory

  • -h is to get the numbers "human readable", e.g. get 140M instead of 143260 (size in KBytes)
  • -s is for summary (otherwise you get not only the size of the folder but also the size of every single file in the folder separately)

$ du -h --max-depth=1 | sort -hr
  • --max-depth=1 shows  the size of the current directory and the size of its immediate subdirectories
  • -hr means sort on human-readable size, in reverse