系統(tǒng)使用時間長后會產生臨時文件(/tmp下),需要清理。但清理的時候不推薦使用rm -rf。這樣有時會引起程序的僵死。
推薦使用tmpwatch命令來進行清理。關于tmpwatch的說明如下:
名稱 : tmpwatch
版本 : 2.8.4
發(fā)布號 : 5
所屬組 : 系統(tǒng)環(huán)境/基礎 源碼包: tmpwatch-2.8.4-5.src.rpm
大小 : 13273 許可類型: GPL
摘要 : 根據文件被訪問的時間來刪除文件的工具。
簡介 :
tmpwatch 工具從指定的目錄中遞歸地搜索,并刪除
在指定時間段內沒有被訪問的文件。tmpwatch 一般
被用來清掃那些用來臨時駐留文件的目錄(譬如,/tmp)
tmpwatch 忽略符號鏈接,它不會切換文件系統(tǒng),而且
只刪除空目錄和常規(guī)文件。
語 法:tmpwatch [-afqv][--test][超期時間][目錄...]
補充說明:執(zhí)行tmpwatch指令可刪除不必要的暫存文件,您可以設置文件超期時間,單位以小時計算。
參數:
-a或--all 刪除任何類型的文件。
-f或--force 強制刪除文件或目錄,其效果類似rm指令的"-f"參數。
-q或--quiet 不顯示指令執(zhí)行過程。
-v或--verbose 詳細顯示指令執(zhí)行過程。
-test 僅作測試,并不真的刪除文件或目錄
實例: sudo /usr/sbin/tmpwatch -afv 3 /tmp (清除/tmp下三小時以內沒有使用的文件,并將結果輸出)。
效果:
[yyc@localhost ~]$ sudo /usr/sbin/tmpwatch -afv 3 /tmp
removing file /tmp/mapping-yyc
removing file /tmp/orbit-yyc/linc-814-0-1bf6199e48d6e
removing file /tmp/orbit-yyc/linc-7ee-0-74c6cf6b5c2c6
removing file /tmp/orbit-yyc/linc-7fd-0-3ae286a04fa21
removing file /tmp/orbit-yyc/linc-854-0-4e3c22c96ddf
removing file /tmp/orbit-yyc/linc-798-0-1c90b9a4739a7
removing file /tmp/orbit-yyc/linc-7e9-0-56828c5c66be1
removing file /tmp/orbit-yyc/linc-815-0-1e0f6f36a2ee3
removing file /tmp/orbit-yyc/bonobo-activation-server-ior
removing file /tmp/orbit-yyc/linc-850-0-5c3b9d5470bfc
removing file /tmp/orbit-yyc/linc-803-0-5ee49981d2cee
removing file /tmp/orbit-yyc/linc-852-0-5c3b9d54bcd06
removing file /tmp/orbit-yyc/linc-83e-0-716284b294fae
removing file /tmp/orbit-yyc/linc-856-0-5c3b9d547287e
removing file /tmp/orbit-yyc/linc-81d-0-1e0f6f36e88f7
removing file /tmp/orbit-yyc/linc-7fa-0-6c21b504ee8e0
removing file /tmp/orbit-yyc/linc-7f9-0-577d962b48783
removing file /tmp/orbit-yyc/linc-7f6-0-1440368b7d5e4
removing file /tmp/orbit-yyc/linc-81a-0-200a47e1c1117
removing file /tmp/orbit-yyc/bonobo-activation-register.lock
removing file /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 file /tmp/ssh-RcIyLY1944/agent.1944
removing file /tmp/.gdmK8P41T
removing file /tmp/gconfd-yyc/lock/ior
關鍵詞標簽:Linux
相關閱讀
熱門文章
安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程
Tomcat9.0如何安裝_Tomcat9.0環(huán)境變量配置方法
多種操作系統(tǒng)NTP客戶端配置
Linux操作系統(tǒng)修改IP
人氣排行 Linux下獲取CPUID、硬盤序列號與MAC地址 dmidecode命令查看內存型號 linux tc實現ip流量限制 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 linux下解壓rar文件 lcx.exe、nc.exe、sc.exe入侵中的使用方法 Ubuntu linux 關機、重啟、注銷 命令 查看linux服務器硬盤IO讀寫負載