When the system is used for a long time, it generates temporary files (/tmp) and needs to be cleaned. However, it is not recommended to use RM-RF when cleaning. This sometimes causes the program to become zombie.
Description of Tmpwatch:
[Email protected] ~2.9. - 1997-2. Tmpwatch [-u|-m|-c] [-MUADFQTVX] [--verbose] [--force] [-- ALL] [--nodirs] [--nosymlinks] [--test] [--quiet] [--atime|--mtime|--ctime] [--dirmtime] [--exclude <path>] [-- Exclude-user <user>]
Brief introduction:
The Tmpwatch tool searches recursively from the specified directory and deletes files that have not been accessed for a specified period of time. Tmpwatch is generally used to sweep directories that are used to temporarily host files (for example,/tmp) Tmpwatch ignores symbolic links, does not switch file systems, and only removes empty directories and regular files.
Syntax: Tmpwatch [-afqv][--test][extended time] [catalogue ...]
Additional note: The Execute tmpwatch instruction can delete unnecessary staging files, you can set the file expiration time, the unit is calculated in hours.
Parameters:
-A or--all delete any type of file.
-F or--force forces the deletion of a file or directory that resembles the "-F" parameter of the RM directive.
-Q or--quiet does not display the instruction execution process.
-V or--verbose shows the instruction execution process in detail.
-test only for testing, does not really delete files or directories
Example: SUDO/USR/SBIN/TMPWATCH-AFV 4/tmp (clears files that are not used within four hours of/TMP and outputs the results).
Examples are as follows:
removingfile/tmp/. ice-unix/sess_25593dd8b8bed7870df27162b7be5125removingfile/tmp/. ice-unix/sess_a0179d8a297cfd463b5fac7fd6efc97cremovingfile/tmp/. ice-unix/sess_6fb81c6b2234f6adc3fbe9557ac713d6removingfile/tmp/. ice-unix/sess_6aadb21e0efe642e5c4a71f01e215865removingfile/tmp/. ice-unix/sess_99d178821da1c33f5eae0511e672d30cremovingfile/tmp/. ice-unix/sess_433ca52b1c31b9af65d373d75890ceb7removingfile/tmp/. ice-unix/sess_d4f9c6129bf2bb1d81398500ac5a569eremovingfile/tmp/. ice-unix/sess_7d29f5d3c259f1c6c4bedde9f975f6c9removingfile/tmp/. ice-unix/sess_54c5baab9a157b9c613a38852ebf4397removingfile/tmp/. ice-unix/sess_b2ac522cec3561e8d4c8172cdd408ae3removingfile/tmp/. ice-unix/sess_9f2de1c14f60637324317cf515b99952removingfile/tmp/. ice-unix/sess_db09a1bc04b65b08b35ab5a4787b7eferemovingfile/tmp/. ice-unix/sess_599d3263d6bf162b136784fd682d30ccremovingfile/tmp/. ice-unix/sess_2b49e884ad6f741a843c3fa237bf74f2removingfile/tmp/. ice-unix/sess_e5d55bfa44d8962eba04f4e57d8d53f5removingfile/tmp/. ice-unix/sess_8f493b6e85505169cafc33c8a3193493removingfile/tmp/. ice-unix/sess_108b66b39811a985177b2ef1e4bf8d30removingfile/tmp/. ice-unix/sess_69327aaafc1dedc20e4b8bea4115850cremovingfile/tmp/. ice-unix/sess_50626890a77806861675b031e1f8cfa1removingfile/tmp/. ice-unix/sess_03e670ba79e12a86190645ce52bf3c43removingfile/tmp/. ice-unix/sess_fb0db280a802e7b824d4d984557eb566removingfile/tmp/. ice-unix/sess_a0f732bc28ed00e5bce03ca52ff9a143removingfile/tmp/. ice-unix/sess_d5490bc5f57098d4ac13e160c9fc179dremovingfile/tmp/. ice-unix/sess_d042ffcea88c97681b9acf59e1b36965removingfile/tmp/. ice-unix/sess_7834543a2e401f1efff4943eae4da14b
The Linux tmpwatch command