Show directory sizes in Linux

January 28, 2008 – 14:38 by Hannes Van de Vel

Use this command to list the directory size of *, ordered from biggest to smallest, output in Mb;

du -sm * | sort -nr | more

du:
-s: don’t list each subdirectory, only first level (subdirs are included in size count though)
-k or -m: show sizes in kilobytes or megabytes

sort:
-n: order numbers, not alfabetically
-r: reverse (show biggest numbers first)

  1. One Response to “Show directory sizes in Linux”

  2. Finds all files over 20,000KB (roughly 20MB) in size and presents their names and size in a human readable format:

    find / -type f -size +20000k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’

    By Tom Van den Berg on Apr 15, 2008

Post a Comment