English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux tmpwatch command

Linux Command大全

The Linux tmpwatch command is used to delete temporary files.

Executing the tmpwatch command can delete unnecessary temporary files. You can set the file expiry time, which is calculated in hours.

Syntax

tmpwatch [-afqv][--test][Expiry Time][Directory...]

Parameters:

  • -a or--all  Delete any type of file.
  • -f or--force  Forcefully delete files or directories, similar to the effect of the "f" parameter in the rm command.-f"parameter.
  • -q or--quiet  Do not display the process of command execution.
  • -v or--verbose  Display detailed process of command execution.
  • -test  Only for testing, does not really delete files or directories.

Online Examples

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

$ tmpwatch 24 /tmp/ #Delete/Files in the tmp directory that have not been used for more than one day

After executing the above command, 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 the tmpwatch command. The operation to switch management privileges is as follows:

$ su                                #Switch to root user  
Password:**********                   #Enter user password  

Linux Command大全