Linux 清空方件方法

Linux 清空方件方法

完全清空文件,不留任何东西,也不加任何东西:
cat /dev/null > filename

下面这个命令有个小问题是,它会在文件中写入一个空行“\n":
echo “” >filename