CentOS7下/tmp目录里面的文件默认保留多久

早上有同事问了下CentOS7下/tmp目录下文件目录保留多久,我记得CentOS6下默认好像是30天,CentOS7下不太确认,所以查了下:

[[email protected] tmpfiles.d]# cd /usr/lib/tmpfiles.d/
[[email protected] tmpfiles.d]# ls
abrt.conf                 iscsi.conf           net-snmp.conf         rpcbind.conf         spice-vdagentd.conf   tuned.conf
cups.conf                 legacy.conf          openlmi-storage.conf  rpm.conf             svnserve.conf         var.conf
cups-lp.conf              libselinux.conf      pam.conf              samba.conf           systemd.conf          x11.conf
etc.conf                  libstoragemgmt.conf  ppp.conf              sap.conf             systemd-nologin.conf
gvfsd-fuse-tmpfiles.conf  lvm2.conf            python.conf           selinux-policy.conf  tmp.conf
initscripts.conf          mdadm.conf           radvd.conf            setroubleshoot.conf  tog-pegasus.conf
[[email protected] tmpfiles.d]# cat /usr/lib/tmpfiles.d/tmp.conf 
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
# See tmpfiles.d(5) for details
# Clear tmp directories separately, to make them easier to override
v /tmp 1777 root root 10d
v /var/tmp 1777 root root 30d
# 默认保留时间变为了10天,如果这10天内没做任何调整,估计会被干掉
# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*
X /tmp/systemd-private-%b-*/tmp
x /var/tmp/systemd-private-%b-*
X /var/tmp/systemd-private-%b-*/tmp

CentOS6的配置文件是在/etc/cron.daily下,有兴趣的朋友自己查下,网上资料比较多

参考资料:

https://developers.redhat.com/blog/2016/09/20/managing-temporary-files-with-systemd-tmpfiles-on-rhel7/

http://blog.csdn.net/zhidetian/article/details/51906335

时间: 2024-08-30 05:04:25

CentOS7下/tmp目录里面的文件默认保留多久的相关文章

Linux下tmp目录删除规则

我们知道,在Linux系统中/tmp文件夹里面的文件会被清空,至于多长时间被清空,如何清空的,可能大家知识的就不多了,所以,今天我们就来剖析一个这两个问题. 在RHEL\CentOS\Fedora\系统中(本次实验是在RHEL6中进行的) 先来看看tmpwatch这个命令,他的作用就是删除一段时间内不使用的文件(removes files which haven't been accessed for a period of time).具体的用法就不多说了,有兴趣的自行研究.我们主要看看和这个

CentOS7下安装phpcmsV9时提示文件权限不可写

1.  将/var/www/html/phpcms目录所属用户和组修改为apache [[email protected] html]#  [[email protected] html]# pwd /var/www/html [[email protected] html]# ls  index.php  itop  phpcms [[email protected] html]#  [[email protected] html]# chown -R apache:apache phpcms

ubuntu下统计目录及其子目录文件个数

查看某目录下文件的个数 ls -l |grep "^-"|wc -l 或 find ./company -type f | wc -l 查看某目录下文件的个数,包括子目录里的. ls -lR|grep "^-"|wc -l 查看某文件夹下目录的个数,包括子目录里的. ls -lR|grep "^d"|wc -l 说明: ls -l 长列表输出该目录下文件信息(注意这里的文件,不同于一般的文件,可能是目录.链接.设备文件等) grep "

Linux下关于/tmp目录的清理规则

本文将介绍Linux下/tmp目录的清理规则,rhel6和rhel7将以完全不同的两种方式进行清理. RHEL6 tmpwatch命令 tmpwatch 是专门用于解决"删除 xxx天没有被访问/修改过的文件"这样需求的命令. 安装: [[email protected] ~]# yum install tmpwatch.x86_64 使用: man tmpwatch tmpwatch - removes files which haven't been accessed for a

linux 下/var,/etc,/tmp目录操作

显示/var/目录下所有以1开头,以一个小写字母结尾,且中间至少出现一位数字(可以有其他字符)的文件或目录. 命令: ls -d /var/1*[0-9]*[a-z] 显示/etc目录下,以任意一个数字开头,且以非数字结尾的文件或目录. 命令: ls -d /etc/[[:digit:]]*[[1]] 显示/etc目录下,亦非字母开头,后面跟了一个字母以及其他任意长度任意字符的文件或目录. 命令: ls -d /etc/[[2]][[:alpha:]]* 在/tem目录下创建以tfile开头,后

解决Linux下Tomcat日志目录下的catalina.log日志文件过大的问题

本文摘自:(http://blog.csdn.net/stevencn76/article/details/6246162) 分类: Java技术专区2011-03-13 12:25 5017人阅读 评论(1) 收藏 举报 tomcatlinux工具任务web 由于Tomcat在默认情况下会将没有经过配置的web应用所产生的日志输出已经其本身的日志内容都输出到这个文件中,那么随着时间的推移,这个文件的尺寸将会越来越大,当需要检查日志内容时间会导致文件难以打开,而且同时tomcat依旧在不断的向文

linux下为目录和文件设置权限,

linux下为目录和文件设置权限,包括子目录的循环递归设置 chmod  命令可以改变所有子目录的权限,下面有2种方法 改变一个文件的权限: chmod mode file|dir 改变所有子目录的权限: chmod mode dir -R                  注意后面加了个-R参数 参数就是权限模式 mode = 777 or 752 ,666,,, mode 的三个数字,分别表示owner,group,others所具有的权限. 1 = x 执行 2 = w 写 4 = r 读

linux网络编程之面试题----------统计目录下所有目录和文件个数

题目如下: 实现linux下tree的单一功能[只打印目录个数和文件个数(不包含隐藏文件)] 首选我们介绍几个相关的linux 系统API 函数名 函数描述 函数声明 opendir 打开一个目录,成功返回一个DIR*类型指针,失败返回NULL DIR* opendir(const char* name) readdir 读取打开的目录下的子成员,成功返回结构体指针,否则返回NULL struct dirent* readdir(DIR* dir) closedir 关闭已打开的目录.成功返回0

老男孩教育每日一题-2017年5月24日-脑洞神探之tmp目录的下的备份文件突然没了,谁来背锅?

1.题目 2.参考答案 1.运维干的2.开发干的3.系统干的,系统安装了一个命令tmpwatch,定期删除文件. 在Centos/RHEL/Fedora系统下存在清理机制(Ubuntu下没有,我的系统是CentOS6)yum -y install tmpwatchtmpwatch命令的作用就是删除一段时间内不使用的文件安装后会在/etc/cron.daily/目录下生成一个tmpwatch文件.内容如下: #! /bin/sh flags=-umc /usr/sbin/tmpwatch "$fl