Quick View File Size on UNIX without du
I have been using du
to get the statistics about my file/folder sizes for years. Yet du
is too slow for my need as I usually only want a quick overview of the sizes.
After some search I found this answer much handy to me on SuperUser:1
# Mac
find . -type f -print0 | xargs -0 stat -f'%z' | awk '{b+=$1} END {print b}'
# Linux
find . -type f -print0 | xargs -0 stat -c'%s' | awk '{b+=$1} END {print b}'
This will give me the statictics much faster than du
.
-
Aug 14, 2014: update Linux stat command. ↩