Linux

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 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts