Delete content of a file using Truncate

On  

There are times when we need to remove content from a file from our server space. Especially, those unwanted log content which are produced on the fly by your codes on purpose.

To my experience, some logs that are already checked should be deleted to save server space.

Note that when the log file exceeds the maximum file size defined in the configuration, it created another new one and rename the previous one to be something like domain.com.error.log.1, domain.com.error.log.2, and so on.

To remove those backup logs, just excecute the command

rm domain.com.error.log.*

To delete the content of the domain.com.error.log file, run the following command:

truncate -s 0 domain.com.error.log

About Author:

I am a WordPress lover. I make my living using WordPress.

Leave A Comment

អាសយដ្ឋាន​អ៊ីមែល​របស់​អ្នក​នឹង​មិន​ត្រូវ​ផ្សាយ​ទេ។ វាល​ដែល​ត្រូវ​ការ​ត្រូវ​បាន​គូស *