I need to clear a log file with:
cat /dev/null > error.log
The problem is that the file is owned by root
-rw-r--r-- 1 root root 15505 Feb 9 15:08 error.log
and this doesn't work
$ sudo cat /dev/null > error.log
-bash: error.log: Permission denied
no idea why... so how could I get around this?
> error.logwill zero the file just the same. (Use the answer below to combine it with sudo.) – Aaron Copley Feb 09 '14 at 15:29