Been a while since I’ve posted any snippets, but this one was rather handy. We had shortage of File space on a production server. An old PHP Set-up we had running started to produce some heavy error logs. I didn’t want to have to find how much space this was grossing, so this handy lil’ command line lists & tells you just that.
<br /> /bin/find / -type f -name error_log | xargs du -h --total<br />
Which will produce you a neat little list:
<br /> 4.0K /home/site1/public_html/error_log<br /> 4.0K /home/site2/public_html/example/error_log<br /> 9.6M /home/site2/public_html/homepage/error_log<br /> 600K /home/site3/public_html/common/error_log<br /> 12K /home/site2/public_html/scripts/user/error_log<br /> 30.2 Total<br />
If you wish then to delete them, replace
| xargs du -h --total with the
-delete flag for find:
<br /> /bin/find / -type f -name error_log -delete<br />