Tuesday, July 6, 2010

Truncate a file

Hi All,

Many a times when we work on the console of UNIX based systems - we will  have very little access to Windows or X terminal.
This  post explains how to truncate a file. Truncate a file as in deleting all the lines of the file.

This is done usually when we want to clear the logs.

This below command does our job:

cat /dev/null > filename.extension

Note that its a single '>' and not '>>'

Take care,
Ananth S Gouri

No comments:

Post a Comment