I am using du -hsx * | sort -rh | head -10
to get top 10 space consuming files in directory. So I would like to know how to pass output of above command and delete those files. I know about xargs
but I don't know how to incorporate it in my command, so any help would be appreciated ?
Thanks
You can do something like this:
du -sxh * | sort -rh | head -10 | xargs rm -fr $1