How to just:
Categories: Technical | Food | design | Other | All

How to just zero out a file without removing it

Description:

How to remove the contents of a file on linux/bsd without actually removing it. This is useful if you want to nuke something like a log file, but don't want to lose the permissions.


It's really easy. Say your file is called "foo.log" just do this:
 $ >foo.log
use the "greater than" symbol, followed by the file name. It will erase the contents of the file, but will do it "in place". Enjoy :).

Link to this



Be sure to check out our other project, Thingist - Things you love Looking for other Technical articles?
Here is another random article from this category:

How to password protect an apache directory

You want to password protect a website? directory on a website? This is how.

Read More
Be sure to check out our other project, Thingist - Things you love