Last Updated: February 25, 2016
· lotia

display size of found files

find . -type f -name "*.bz2" | xargs du -h

The above snippet finds all files ending with the *.bz2 suffix and pipes the results to xargs which executes du -h on the passed arguments providing results in human readable form.

Piping to xargs provide a more portable alternative to using -exec since BSD find and GNU find behave differently.