Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 5 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .