Full Stack WordPress Developer


Delete content of a file using Truncate

Every once or twice a month, I usually pay a visit to servers I've owned or those I've run for my clients. Truncate command helps me save loads of disk space

Ads: Register now via this link to receive $100 credit from Vultr

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,, and so on.

To remove those backup logs, just execute the command


To delete the content of the file, run the following command:

truncate -s 0

Leave a Reply

Your email address will not be published. Required fields are marked *