|
How to truncate files in Linux without deleting it
11 April 2008
Sometimes you need just to truncate a log file without deleting it. There are reasons to do so: for example it is a log file, and a kind of daemon still writes logs in this file. So deleting this file means that daemon won't be able to find inode of old file, and he will stop to write logs. So, to avoid this situation we need just to truncate file without deleting it.
How to do it?
Very simple :-)
Just type:
>myfilename.log
|
|
|