Skip to content

Instantly share code, notes, and snippets.

@jamiehs
Created July 10, 2013 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiehs/5967534 to your computer and use it in GitHub Desktop.
Save jamiehs/5967534 to your computer and use it in GitHub Desktop.
# 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