3

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
3
  • What about find /tmp -type f -size +50000k -delete ?
    – user49740
    Commented Aug 5, 2013 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.
    – FilBot3
    Commented Aug 5, 2013 at 16:14
  • 1
    mywiki.wooledge.org/ParsingLs – why you shouldn't parse the output of ls
    – slhck
    Commented Aug 5, 2013 at 16:16

1 Answer 1

11

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

You must log in to answer this question.

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