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

Contact

604-309-8713
info@solidfoundationwebdev.com

Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected