Tmp cleanup method

Source: Internet
Author: User
Clean up the tmp method-general Linux technology-Linux technology and application information. The following is a detailed description. A temporary file (under/tmp) is generated after the system has been used for a long time and needs to be cleared. However, it is not recommended to use rm-rf during cleaning. This may cause program freezing.
 
We recommend that you use the tmpwatch command for cleanup. Tmpwatch is described as follows:
 
Name: tmpwatch
 
Version: 2.8.4
 
Release No.: 5
 
GROUP: System Environment/basic source package: tmpwatch-2.8.4-5.src.rpm
 
Size: 13273 license type: GPL
 
Abstract: A tool used to delete a file based on the time when the file is accessed.
 
Introduction:
 
The tmpwatch tool recursively searches the specified directory and deletes files that are not accessed within the specified period of time. Tmpwatch is generally used to clean directories (for example,/tmp) that are used to temporarily resident files. tmpwatch ignores symbolic links. It does not switch to the file system and only deletes empty directories and regular files.
 
Syntax: tmpwatch [-afqv] [? Test] [expiration time] [directory…]
 
Note: Execute the tmpwatch command to delete unnecessary temporary files. You can set the file expiration time, measured in hours.
 
Parameters:
 
-A or ?? All: delete any types of files.
 
-F or ?? Force deletes files or directories. The effect is similar to the "-f" parameter of the rm command.
 
-Q or ?? Quiet does not display the command execution process.
 
-V or ?? Verbose details the instruction execution process.
 
-Test is only used for testing and does not really delete files or directories.
 
Example: sudo/usr/sbin/tmpwatch-afv 3/tmp (clear files not used in the next three hours of/tmp and output the results ).
 
Effect:
 
[Yyc @ localhost ~] $ Sudo/usr/sbin/tmpwatch-afv 3/tmp
Removing file/tmp/mapping-yyc
Removing files/tmp/orbit-yyc/linc-814-0-1bf6199e48d6e
Removing files/tmp/orbit-yyc/linc-7ee-0-74c6cf6b5c2c6
Removing files/tmp/orbit-yyc/linc-7fd-0-3ae286a04fa21
Removing files/tmp/orbit-yyc/linc-854-0-4e3c22c96ddf
Removing files/tmp/orbit-yyc/linc-798-0-1c90b9a4739a7
Removing files/tmp/orbit-yyc/linc-7e9-0-56828c5c66be1
Removing files/tmp/orbit-yyc/linc-815-0-1e0f6f36a2ee3
Removing file/tmp/orbit-yyc/bonobo-activation-server-ior
Removing files/tmp/orbit-yyc/linc-850-0-5c3b9d5470bfc
Removing files/tmp/orbit-yyc/linc-803-0-5ee49981d2cee
Removing files/tmp/orbit-yyc/linc-852-0-5c3b9d54bcd06
Removing files/tmp/orbit-yyc/linc-83e-0-716284b294fae
Removing files/tmp/orbit-yyc/linc-856-0-5c3b9d547287e
Removing files/tmp/orbit-yyc/linc-81d-0-1e0f6f36e88f7
Removing files/tmp/orbit-yyc/linc-7fa-0-6c21b504ee8e0
Removing files/tmp/orbit-yyc/linc-7f9-0-577d962b48783
Removing files/tmp/orbit-yyc/linc-7f6-0-1440368b7d5e4
Removing files/tmp/orbit-yyc/linc-81a-0-200a47e1c1117
Removing files/tmp/orbit-yyc/bonobo-activation-register.lock
Removing files/tmp/orbit-yyc/linc-7f7-0-5950ba2b9774d
Removing directory/tmp/orbit-yyc if not empty
Removing file/tmp/. esd-500/socket
Removing file/tmp/pulse-yyc/pid
Removing file/tmp/pulse-yyc/native
Removing file/tmp/ keyring-Mf0bbZ/socket
Removing file/tmp/. X0-lock
Removing file/tmp/. X11-unix/X0
Removing file/tmp/. ICE-unix/1944.
Removing files/tmp/ssh-RcIyLY1944/agent.1944
Removing file/tmp/. gdmK8P41T
Removing file/tmp/gconfd-yyc/lock/ior
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.