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 have a server (RHEL 5) with 50+ websites currently running on the same eCommerce software, today I found one of the error log files was over 3GB in size.

Is there a way I can find all files over say 20MB on the system and empty them using the file pattern below?

/var/www/vhosts/*/httpdocs/system/logs/error.log
share|improve this question
up vote 2 down vote accepted
find /var/www/vhosts -name error.log -size 20M -exec ls -la {} \;

You can substitute any action you want for the "ls -la {}" - the {} is replaced with the filename.

Please note that this will find all files named error.log, not just those in httpdocs/system/logs/ folders.

share|improve this answer
1  
I believe you mean -size +20M. – Scott Dec 20 '12 at 23:39

You must log in to answer this question.

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