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.
Written by Ali Asad Lotia
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Find
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#