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

简介:

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@kvm02 tmpfiles.d] # cd /usr/lib/tmpfiles.d/
[root@kvm02 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
[root@kvm02 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
/tmp/systemd-private- %b-*
/tmp/systemd-private- %b-* /tmp
/var/tmp/systemd-private- %b-*
/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










本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1983723,如需转载请自行联系原作者
目录
打赏
0
0
0
0
235
分享
相关文章
VMware隐藏黑科技!CentOS安装这个神器效率翻倍 文件互传竟比U盘还快?
### 安装VMtools的作用及步骤 安装VMtools可以实现Windows与CentOS之间的字符串和命令粘贴、文件夹共享等操作。在CentOS中,通过VMware菜单栏选择“VMware Tools”,将下载的压缩包拷贝到`/opt`目录并解压。接着进入终端,使用`./vmware-install.pl`命令完成安装。安装后重启系统,即可实现Windows与CentOS之间的字符和文件共享。具体步骤包括解压文件、启动命令行终端、安装VMtools以及配置文件共享。
77 16
VMware隐藏黑科技!CentOS安装这个神器效率翻倍 文件互传竟比U盘还快?
Centos7.9版本安装collectd并开启写入rrd文件功能
Centos7.9版本安装collectd并开启写入rrd文件功能
107 13
inux CentOS 7 如何进入默认工作目录 [root@localhost ~]
这篇文章讨论了如何在Linux CentOS 7系统中进入默认工作目录。默认工作目录通常是用户的主目录,表示为`[root@localhost ~]`,其中波浪号`~`代表当前用户的主目录。文章可能还包含了如何打开这个默认工作目录的步骤和说明。不过,具体内容没有提供详细信息,通常可以通过打开终端并使用`cd ~`命令来进入默认工作目录。如果需要更详细的步骤或有特定的问题,可能需要查看原文获取更多信息。
2022年超详细如何使用Xftp连接CentOS 7来进行文件的传输【详细过程、图解】
这篇文章提供了使用Xftp工具连接到CentOS 7虚拟机进行文件传输的详细步骤和图解。步骤包括打开Xftp软件、创建新连接、查看并填写虚拟机的IP地址、输入虚拟机的连接账号密码,以及连接成功后进行文件传输。文章最后以"现场手撸、学无止境"作为结束语,鼓励读者不断学习和实践。
揭秘CentOS 7:系统目录奥秘大起底,网卡配置秒变高手,让你的服务器管理飞一般的感觉!
【8月更文挑战第5天】CentOS 7作为RHEL的社区版本,以其稳定性和丰富功能广受好评。本文通过案例分析介绍其系统目录结构及网卡配置方法。系统目录如/(根)、/bin(基本命令)、/boot(启动文件)、/dev(设备文件)、/etc(配置文件)、/home(用户目录)和/lib(共享库)等各司其职。网卡配置通过编辑/etc/sysconfig/network-scripts/下的ifcfg文件实现,如设置ens33接口的静态IP地址、子网掩码、网关和DNS服务器,并通过重启网络服务使配置生效。这是系统管理员必备的技能之一。
114 2
Centos定期自动清理临时文件
简单Shell脚本清理临时文件 使用`cron`设置定时任务,如每天8点运行: 记得调整路径和脚本名以匹配你的环境。
191 5
08. 【Linux教程】CentOS 目录介绍
08. 【Linux教程】CentOS 目录介绍
92 2
|
11月前
|
Centos7.4升级7.9失败,救援:/boot目录下文件丢失error: file ‘/initramfs-3.10.0-957.el7.x86_64.img‘ not found
以上步骤应该可以帮助你解决问题。如果问题仍然存在,可能需要更深入的排查。
273 1
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等