How to truncate a log file using Ubuntu Linux

Have you ever wanted to truncate a log file that was being written to by a running process without stopping the process to do so?

If so then all you need is the following to clear out the active log file:

cat /dev/null > some_log_file.log
There are some other great tips over on the Bash Cures Cancer blog.

Technorati Tags: , , , , ,

2 Comments:

askbill said...

Thanks a bunch. Just what I was looking for.

anachronism said...

:> filename

(colon greater-than filename) is a much shorter syntax :)