which one is the best way to clean or empty a file in Linux? I have to zip ( tar ) a file to an archive and then clean/empty it; this is what I do and it works correctly:
tar -zcvf /mnt/file.tar.gz /mnt/file.txt > /dev/null 2>&1
echo "" > /mnt/file.txt
I'm doing it with echo, probably there is a better way ?
Thanks