Archive

Posts Tagged ‘find’

How to calculate the space used by files in Linux?

February 19th, 2010 No comments

Suppose that you want to calculate the space used by all the png files in current directory and all its subdirectories. From a terminal type:

find . -name '*.png' -exec du -ab {} \; | awk '{total+=$0}END{print total}'

Image source