Create Update Empty File on Linux OS

Disclaimer! Be careful before do this step bellow. Make sure you are already prepared for execute.


First try :

$ cat /dev/null > /home/usrdebian/logs/file.log

 

Or you can use "truncate" on linux. It will work recursively.

$  truncate --size 0 /home/usrdebian/logs/*.log


Check :

$ ls -al /home/usrdebian/logs


Source :

https://stackoverflow.com/questions/30895546/cat-dev-null-to-multiple-files-to-clear-existing-files-like-logs

Comments