日期:2014-05-16  浏览次数:20675 次

Linux版一键清理系统垃圾文件
@echo off 
echo 正在清除系统垃圾文件,请稍等...... 
del /f /s /q %systemdrive%\*.tmp 
del /f /s /q %systemdrive%\*._mp 
del /f /s /q %systemdrive%\*.log 
del /f /s /q %systemdrive%\*.gid 
del /f /s /q %systemdrive%\*.chk 
del /f /s /q %systemdrive%\*.old 
del /f /s /q %systemdrive%\recycled\*.* 
del /f /s /q %windir%\*.bak 
del /f /s /q %windir%\prefetch\*.* 
rd /s /q %windir%\temp & md %windir%\temp 
del /f /q %userprofile%\cookies\*.* 
del /f /q %userprofile%\recent\*.* 
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" 
del /f /s /q "%userprofile%\Local Settings\Temp\*.*" 
del /f /s /q "%userprofile%\recent\*.*" 
echo 清除系统LJ完成! 
echo. & pause 

这个是Windows版本的,求高手写个LINUX版的~~~
------解决方案--------------------
首先先要明确垃圾的定义.对于不同的人,不同的时间,不同的目的.垃圾文件是很不相同的.

其次,一般的清理就rm就好了.
    如需要清除数据(例如保密信息)那再参考美国那个什么信息抹去标准对磁盘进行特定的写/覆盖操作.(这个就没怎么研究过了)

rm -rf <匹配的无用文件表达式>

您必须知道自己在干什么,不然很可能删除掉一些不像删除的文件,造成不可预料的后果.
------解决方案--------------------
谁是垃圾。。
------解决方案--------------------
我这里有一个自己写的linux下粉碎文件的shell脚本,然后你自己改一下就可以了。

其实就像3楼说的,看你怎么定义垃圾文件了,只要你能确定垃圾文件的范围,自己写个脚本就删。
------解决方案--------------------
很多log,chk文件都是分析解决问题的好资料。资源不紧张的话不建议删除。此类文件暴增的原因一般是频繁的错误。
如果真想删,删/tmp下的吧