Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux tmpwatch command

Linux tmpwatch command

Linux Command Reference Linux Command Reference

The Linux tmpwatch command is used to delete temporary files.

Executing the tmpwatch command can delete unnecessary temporary files. You can set the file expiration time in hours.

Syntax

tmpwatch [-afqv][--test][超期时间][目录...]

Parameters:

Example

To use the "tmpwatch" command to delete files in the "/tmp" directory that have not been used for more than a day, enter the following command:

$ tmpwatch 24 /tmp/ #删除/tmp目录中超过一天未使用的文件

After the above command is executed, the result is as follows:



removing directctmp/orbit-tom if not empty 

Note: This command requires root privileges, so you should use the su command to switch users before using tmpwatch. The operation to switch administrative privileges is as follows:



$ su                                #切换到root用户  

口令:**********                   #输入用户密码  

Linux Command Reference Linux Command Reference