How To Empty A Logfile On The Command Line

Posted by Weston Ganger

I needed to clear my logfile but I didnt want to go through the hassle of deleting, creating, and worrying about permissions

Heres a command to just simply clear it.

# Method 1
truncate logfile --size 0

# Method 2
cat /dev/null > logfile

# Method 3
> logfile

Related External Links:

Article Topic:Software Development - Linux

Date:February 13, 2016

Recommended Posts