If I try truncate -s 0 log.log
(:>log.log
has same behavior) the displayd space on disk do become free but the size (ls -l
) of file is still the same (tho du
shows less). As far as I understand, it happens because the pointer is still "old".
This behavior causes that I cannot use cat ... | grep ...
command: CLI says that file is binary. So the only way is to use less
or another commands.
So, how do I truncate file, that is opened in write mode in another proccess and have correct file size after truncate?
I need data in log.log
to be truncated to another file, or just delete whole data in file without deleting the file itself