红联Linux门户
Linux帮助

/tmp文件夹下的文件能删除吗

发布时间:2008-03-13 11:03:22来源:红联作者:josephwu
/tmp文件夹下的文件能删除吗?对系统有没有影响?
文章评论

共有 6 条评论

  1. kunta_dy 于 2010-04-15 10:51:22发表:

    看看

  2. deepwhite 于 2008-03-13 16:05:41发表:

    引用:
    原帖由 相思爱文 于 2008-3-13 13:22 发表
    别把/tmp文件夹删了就行。
    我刚刚以用户身分执行了下面的命令
    cd /tmp
    rm -rf *


    Linux本身就有临时文件清理的命令,例如Fedora/Redhat中,如果打开了crond,你可以去看看里面设置的计划,其中就有一条是用来清理临时文件的。
    但是不推荐使用rm -rf这个方法来对临时文件进行清理,推荐使用tmpwatch命令。例如 [code]sudo /usr/sbin/tmpwatch -afv 3 /tmp[/code]
    有兴趣的可以看看:http://hi.baidu.com/yangyingchao/blog/item/a1b17423c43556519822edb8.html

  3. 相思爱文 于 2008-03-13 13:22:49发表:

    别把/tmp文件夹删了就行。
    我刚刚以用户身分执行了下面的命令
    cd /tmp
    rm -rf *

    [ 本帖最后由 相思爱文 于 2008-3-13 13:25 编辑 ]

  4. 奶茶dsk 于 2008-03-13 12:19:30发表:

    very good...

  5. wave654321 于 2008-03-13 12:17:15发表:

    学习!!

  6. gxf 于 2008-03-13 11:30:45发表:

    Files in /tmp should not be touched unless you know exactly what they are for and what they are doing. Lock files might be in /tmp, some programs rely on the use of /tmp and it expects it's files to be there when it looks. PostgreSQL for example uses /tmp, and deleting a certain file from there could break it (or at least require you to restart the server). Things in /tmp are temporary though, anything that uses /tmp needs to expect that /tmp will be empty on boot and that files not used for long periods of time may be deleted. Most distros at least delete /tmp on boot and/or shutdown. Some distros do check files in /tmp and delete those which haven't been used for a long time. But in general, do not touch /tmp.

    删除后造成不正常登陆解决办法:http://tech.ccidnet.com/art/3067/20070919/1218005_1.html