Skip to content

Instantly share code, notes, and snippets.

@mislav
Last active December 22, 2018 19:56
Show Gist options
  • Star 40 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mislav/4732458 to your computer and use it in GitHub Desktop.
Save mislav/4732458 to your computer and use it in GitHub Desktop.
Find "*.log" files in your home dir, sort them by fattest-first, and calculate the size of them all together.
find ~ -name '*.log' -print0 | xargs -0 -L1 stat -f'%z %N' | sort -rn | tee fat-logfiles.txt | head
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt
@13k
Copy link

13k commented Feb 7, 2013

linux version:

find ~ -name '*.log' -print0 | xargs -0 -L1 stat -c '%s %N' | sort -rn | tee fat-logfiles.txt | head
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt

@henrik
Copy link

henrik commented Feb 7, 2013

Maybe /tmp/fat-logfiles.txt, not to litter your working dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment