I have a file called error.log on my server that I need to frequently truncate. I have rw permissions for the file. Opening the file in vi > deleting all content > saving wo
You can also use function truncate
$truncate -s0 yourfile
if permission denied, use sudo
$sudo truncate -s0 yourfile
Help/Manual: man truncate
tested on ubuntu Linux