Unix find average file size

前端 未结 7 2378
忘掉有多难
忘掉有多难 2020-12-13 09:23

I have a directory with a ton of files I want to find the average file size of these files so something like ls somethinghere whats the average file size of everyth

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 09:59

    I found something here:
    http://vivekjain10.blogspot.com/2008/02/average-file-size-within-directory.html

    To calculate the average file size within a directory on a Linux system, following command can be used:

    ls -l | gawk '{sum += $5; n++;} END {print sum/n;}'
    

提交回复
热议问题