Is there a proper way to clear log files on Unix? You can simply truncate a log file using > filename syntax. For example if log file name is /var/log/foo, try > /var/log/foo as root user.
How do I nullify a log file in Linux?
Empty log file using truncate command
The safest method to empty a log file in Linux is by using the truncate command. Truncate command is used to shrink or extend the size of each FILE to the specified size.
How do you clear a log file?
When the Command Prompt window opens, type the command “cd” (without quotes) and press “Enter,” and then type “cd windows” before pressing “Enter” once more. You can then enter the command “del *. log /a /s /q /f” and press “Enter” to delete all log files from the Windows directory.