At some point, the contents of the file need to be emptied without deleting the file. Analogy some log files (log.txt); the commands under Linux are:true >log.txt
Test results:
Touch Log.txt → #新建文件log. txt
VI log.txt → #编辑 file
Whatever you want to enter.
: wq! return → #保存退出;
Cat Log.txt → #查看 The contents of the document;
true >log.txt → #查看 the contents of the document;
Report:
Rm-r Delete directories, regardless of whether there are files in the directory
RM-RF forced deletion, no hint
Generally used in these two, delete files can be used rm-f, the same is forced to delete
RM-RF File Man RM also has the option of using/etc/null, which is also equivalent to the Recycle Bin in Windows!
CAT/ETC/PASSWD |cut-f 1-d: View all Users
SU Switch User
Userdel Delete User Name
AddUser username New User
The above Linux does not delete files, empty the contents of the file command is small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.