Monday, March 7, 2011

Quickly clear out a file's contents

If you ever have the need to quickly clear out the contents of a file while preserving its priviledges and creation date, use this command:

echo " " > myConfig.xml

or

echo " " > /etc/my.cnf