Command Line

When developing, I usually have a log file for tests and development for me to keep track of what’s happening. The thing is that logs become too large. Some editors or viewers can’t open the file. They are sometimes too large to be usable.

I just delete the contents and fill it up until the next time.

Here are a few ways to delete file contents from the command line.

> filename

> log/development.log

echo

echo "test" > log/test.log

cat

cat /dev/null > log/test.log

There are probably millions of ways to do this but the above are the quickest

cp

cp /dev/null log/development.log