Search code examples
freebsd

Clear contents of text file FreeBSD


Typically I'd use > /var/log/snort/alert however on FreeBSD this doesn't work. 'Invalid null command' error is thrown. Any way to do this other than deleting and making a new file?


Solution

  • This should work canonically on all Unix-like systems: echo > /path/to/file. Most important is that the file descriptor will be retained.