Command to completely clear the file:
(Related recommendations: macos)
//注意冒号:是占位符 $ :>filename $ cat /dev/null > filename $ cp /dev/null filename
If you don’t mind empty lines inside or space, you can also use the following command:
$ echo “” > filename $ echo /dev/null > filename $ echo > filename
The above is the detailed content of How to use the command line to clear files under macos. For more information, please follow other related articles on the PHP Chinese website!