Skip to content

Instantly share code, notes, and snippets.

Last active December 22, 2018 19:56
What would you like to do?
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
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