Created
March 24, 2022 19:47
-
-
Save techie2000/ed48b3315c3fd04e459321f6b3ab8f0d to your computer and use it in GitHub Desktop.
histogram of file sizes, and how many files are in that size range.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -print0 | xargs -0 ls -l | awk '{ n=int(log($5)/log(2)); if (n<10) { n=10; } size[n]++ } END { for (i in size) printf("%d %d\n", 2^i, size[i]) }' | sort -n | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) } } { a[1]=$1; a[2]=0; human(a); printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) }' | |
--e.g. | |
-- 1k: 270448 | |
-- 2k: 72548 | |
-- 4k: 74510 | |
-- 8k: 62799 | |
-- 16k: 36386 | |
-- 32k: 74070 | |
-- 64k: 21528 | |
--128k: 30624 | |
--256k: 25892 | |
--512k: 83264 | |
--1M: 140595 | |
--2M: 23716 | |
--4M: 14846 | |
--8M: 4843 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment