Latest web development tutorials

Linux tmpwatch command

Linux command Daquan Linux command Daquan

Linux tmpwatch command is used to delete temporary files.

Tmpwatch instruction execution can delete unnecessary scratch file, you can set file expiration time, unit in hours.

grammar

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

Parameters:

  • -a or --all delete any type of file.
  • -f or --force force delete a file or directory, the effect is similar to the rm command "-f" parameter.
  • -q or --quiet do not show the process of executing instructions.
  • -v or --verbose detail display during the execution of instructions.
  • -test only for testing, do not really delete files or directories.

Examples

Using the command "tmpwatch" remove directory "/ tmp" file more than one day not used, enter the following command:

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

After the above command is executed, its execution results are as follows:

removing directctmp/orbit-tom if not empty 

NOTE: This command requires root privileges, so the use of switch user tmpwatch before command should use the su command. Switching operations management authority as follows:

$ su                                #切换到root用户  
口令:**********                   #输入用户密码  

Linux command Daquan Linux command Daquan