CentOS系统/tmp目录里面的文件默认保留多久
一、CentOS系统/tmp目录里面的文件默认保留多久
CentOS6默认保留30天,CentOS7默认保留10天
一、CentOS7系统/tmp目录里面的文件默认保留多久
CentOS7默认保留10天,查看系统配置如下
[root@v05-docker-net-test02 ~]# cd /usr/lib/tmpfiles.d/ [root@v05-docker-net-test02 tmpfiles.d]# ls etc.conf iptraf-ng.conf libselinux.conf pam.conf python.conf rpm.conf selinux-policy.conf systemd.conf tmp.conf var.conf initscripts.conf legacy.conf lvm2.conf ppp.conf rpcbind.conf sap.conf sudo.conf systemd-nologin.conf tuned.conf x11.conf
[root@v05-docker-net-test02 tmpfiles.d]# cat 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 # 默认保留时间变为了10天,如果这10天内没做任何调整,会被处理 v /tmp 1777 root root 10d v /var/tmp 1777 root root 30d # 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系统/tmp目录里面的文件默认保留多久
CentOS6默认保留30天,查看系统配置如下
root@v01-apppre-mobile01 ~]# cd /etc/cron.daily [root@v01-apppre-mobile01 cron.daily]# ls logrotate makewhatis.cron mlocate.cron prelink readahead.cron tmpwatch
[root@v01-apppre-mobile01 cron.daily]# cat logrotate #!/bin/sh /usr/sbin/logrotate /etc/logrotate.conf EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" fi exit 0 [root@v01-apppre-mobile01 cron.daily]# cat tmpwatch #! /bin/sh flags=-umc /usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \ -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \ -X '/tmp/hsperfdata_*' -X '/tmp/.hdb*lock' -X '/tmp/.sapstartsrv*.log' \ -X '/tmp/pymp-*' 10d /tmp /usr/sbin/tmpwatch "$flags" 30d /var/tmp for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do if [ -d "$d" ]; then /usr/sbin/tmpwatch "$flags" -f 30d "$d" fi done
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人