How to clear the contents of a file from the command line? You can use the user command : truncate truncate -s 0 test.txt ("-s 0" to specify the size) http://www.commandlinefu.com/commands/view/12/empty-a-file https://superuser.com/questions/90008/how-to-clear-the-contents-of-a-file-from-the-command-line