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.
Written by Mitchell Turner
Related protips
1 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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Linux
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#