Du

From HalfgeekKB
Jump to navigation Jump to search

du is a unixish program for determining information about disk usage.

Sample command:

   du -h | sort -h

For du,

  • -h means use human-readable sizes (e.g. 1.2G instead of e.g. 1202783468)
  • -d N (or --max-depth=N) means don't go more than N levels deep.

For sort, the -h flag causes decoding human-readable sizes and sorting by their actual values. (If -h is left off du, use sort -n for plain numeric sort, though, actually, -h would probably still work for that too.) This command sorts the output so that the largest dirs are at the end (and are less likely to vanish off the end of the scrollback buffer), which helps narrow down where attention is needed.