Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to find and rm -rf large files in RHEL, but what I would expect from this command that would give me purely the file directories, feeding them into rm -rf, it is not removing them. My FU might be off, so please review this line, I thought it would work.

find /tmp -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 }' | rm -rf
share|improve this question
    
What about find /tmp -type f -size +50000k -delete ? –  user49740 Aug 5 '13 at 16:13
    
That's exactly what worked, I was going to post an answer, but I'm taking care of something else at the moment. You can answer with that. That works. –  Pred Aug 5 '13 at 16:14
1  
mywiki.wooledge.org/ParsingLs – why you shouldn't parse the output of ls –  slhck Aug 5 '13 at 16:16
add comment

1 Answer

up vote 3 down vote accepted

You can use find /tmp -type f -size +50000k -delete instead, which is clearer, simpler and more efficient.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.