运维联盟俱乐部

 找回密码
 立即注册
查看: 2443|回复: 0

find

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2020-9-20 10:09:28 | 显示全部楼层 |阅读模式
    -a-c-m得意义
    1. -atime n
    2. File  was  last  accessed  n*24 hours ago.  When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to  have been accessed at least two days ago.

    3. -ctime n
    4. File's status was last changed n*24 hours ago.  See the comments for -atime to understand how rounding affects the interpretation of file status change times.

    5. -mtime n
    6. File’s data was last modified n*24 hours ago.See the  comments  for  -atime  to  understand  how rounding affects the interpretation of file modification times.
    复制代码
    n,+n,-n得意义
    1. 找“5天之内被更改过的档案名”find / -mtime -5

    2. 找“5天前的那一天被更改过的档案名”find / -mtime 5

    3. 找“5天之前被更改过的档案名”find / -mtime +5
    复制代码
    示例

    find ./bdump -name *.trc -mtime +15 -exec rm -f {} \;

    find /rman_backup/data -ctime 5 -exec rm {} \;

    find /monitor/nmon/daily -mtime +120 -name "*.nmon" -exec rm -rf {} \;

    find ./ -mtime -3 |xargs tar -zcvf ./osw_archives.tar.gz

    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-3-29 21:33 , Processed in 0.048955 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表