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
答案 0 :(得分:1)
You can do something like this:
du -sxh * | sort -rh | head -10 | xargs rm -fr $1
答案 1 :(得分:1)
你可以,
du -sxh * | sort -rh | head -10 > out
cat out | xargs rm -fr $1