Tuesday, October 9, 2007

Linux : Empty the Contents of a File

How do you empty the contents of a File in Linux ?

cat /dev/null > your_file

The cat command first reads the contents of /dev/null - there's nothing in it. It then writes this into your_file.

A handy way to clear bulky application log files in Linux.