1. The conventional method of emptying the contents of the file
1) using the cat command displays the contents of / dev / null then redirect the output to a file, to empty
$ cat /dev/null > filename
2) clear a null file can be redirected (things not present) to the file by the shell
$ > filename
Another method of emptying file 3) is: or a builtin true output redirected to a file
$ : > filename
$ true > access.log
4) Use the echo command
$ echo "" > filename/$ echo > filename
2. No> Empty file under the purview of the case method
$ echo "" | sudo tee filename
3. batch kill processes specified file name
$ Ps -ef | grep test.py | grep -v grep | awk '{print $ 2}' | xargs sudo kill