Quick Tip : Truncate a file in Linux

Lately I have been looking at improving my command line skills in Linux, and here is a quick tip to truncate a file to zero byte file, helpful to empty huge log files quickly.

:>filename

or you can also use the common method which make more sense:

cat /dev/null > filename

So enjoy and let me know any command line tricks if you know.

Leave a Reply