A powerful membership solution for WordPress

So I was messing around with getting a few logging systems setup for a web app I’m writing and after a while these log files started to grow in size to the point that it was difficult to find the relevant data quickly. I needed a quick way to empty a file without deleting it. Here’s the trick I learned:

Basically ‘cat’ reads the file contents of whatever you specify, in this case /dev/null which is empty. It then uses the ‘>’ character to push the contents of /dev/null (empty) to filename.log, overwriting anything that currently exists in it.

Post Promoter Pro

Posted by Chris Klosowski

Hi, I'm Chris Klosowski. Currently I am a Lead Developer of Easy Digital Downloads, where we build the easiest way to sell digital products with WordPress.

I am also the person behind Post Promoter Pro, the most effective way to promote your WordPress Content.

One Comment

  1. An even quicker way to clear a file:

    $ > filename.log

    😉 Just thought I’d share.

    Reply

Leave a reply

Your email address will not be published. Required fields are marked *