Empty file contents at command line on Linux system

As is often the case I needed to accomplish something, so I tinkered until I figure it out. I had a web site that I recently moved from a PHP 5.2 to 5.3 enabled server. It became a problem when I realized my error logs had filled up with 600 MB of deprecated function messages, and after fixing the issues I wanted to clear out the logs.

While there are a few methods of doing this, I wanted to keep it simple. Here is the command I used:

> filename.log

The greater than symbol is the command which pipes nothing to the file, thus clearing it. This cleared up the file quickly, and left the permissions and filename in place.

Published by

Adam

Application Architect from Florida

Leave a Reply

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