Last Updated: February 25, 2016
·
441
· xandout

Clear the contents of a file on Linux

Sometimes I need to clear the contents of a file but keep the file in place.

To do this it is actually really simple.

> /var/log/syslog

This essentially cats an empty file into the right hand location.

1 Response
Add your response

I had to upvote this... I am suprised on how many Nix users I have talked to that know '>>' and what it is used for but not knowing '>'

over 1 year ago ·