How to empty ("truncate") a file on linux that already exists and is protected in someway?
You have the noclobber
option set. The error looks like it's from csh, so you would do:
cat /dev/null >! file
If I'm wrong and you are using bash, you should do:
cat /dev/null >| file
in bash, you can also shorten that to:
>| file
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
This will be enough to set the file size to 0:
> error.log