How To Empty A Logfile On The Command Line

Posted by Weston Ganger on February 13, 2016

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:

Posted in Linux and Tagged with command-line bash 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts