Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# To calculate the average file size within a directory:
ls -l | gawk '{sum += $5; n++;} END {print sum/n;}'
# If you'd like to know the average size of some particular kind of file:
ls -l *.jpg | gawk '{sum += $5; n++;} END {print sum/n;}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment