Linux tmpwatch command
Translation results:
watch
UK[wɒtʃ] US[wɑ:tʃ]
vt. Watch, pay attention; guard, monitor; wait (for opportunities, etc.); pay close attention
n. Watch; night watch, duty; guard, surveillance; person on duty
vi.Watch; watch; watch; guard
Third person singular: watches Plural: watches Now Participle: watching Past tense: watched Past participle: watched
Linux tmpwatch commandsyntax
Function: tmpwatch command is used to delete temporary files. Execute the tmpwatch command to delete unnecessary temporary files. You can set the file expiration time in hours.
Syntax: tmpwatch [-afqv][--test][Expiration time][Directory...]
Linux tmpwatch commandexample
Use the command "tmpwatch" to delete files that have not been used in the directory "/tmp" for more than one day. Enter the following command:
$ tmpwatch 24 /tmp/ #删除/tmp目录中超过一天未使用的文件
After the above command is executed, the execution result is as follows:
removing directctmp/orbit-tom if not empty
Note: This command requires root permissions, so you should use the su command to switch users before using the tmpwatch command. The operation to switch administrative permissions is as follows:
$ su #切换到root用户 口令:********** #输入用户密码