zoukankan      html  css  js  c++  java
  • find 常用命令

    系统中总会不断产生一些文件,比如日志文件,不一定会用到也不会自动删除,这时候就需要手动删除,当然也可以转存到其他目录下。不好找的时候可以用find模糊查找,加个job定时任务自动执行
    定期删除文件
    1、添加脚本
    [root@rac1 ~]#cat /root/moni/rmaudit.sh
    #00 13 * * 1
    find /u01/app/11.2.0/grid/rdbms/audit/ -mtime +100 -type f -name '*.aud' -exec rm -f {} ;

    2、授权
    chmod +x /root/moni/rmaudit.sh

    3、添加job
    [root@rac1 ~]#crontab -e
    0 1 * * * root ntpdate asia.pool.ntp.org;hwclock -w
    25 14 * * * /root/moni/rmaudit.sh


    这样就可以自动删除了。
    --说明:删除/u01/app/11.2.0/grid/rdbms/audit/目录下、300天前、后缀为aud的文件
    find /u01/app/11.2.0/grid/rdbms/audit/ -mtime +300 -type f -name '*.aud' -exec rm -f {} ;

    Linux 中的文件名是区分大小写的,也就是说,搜索小写文件,是找不到大写文件的。如果想要大小通吃,就要使用 -iname 来搜索文件。
    [root@rhel ~]# touch test
    [root@rhel ~]# touch TEST
    [root@rhel ~]# find . -name test
    ./test
    [root@rhel ~]# find . -name TEST
    ./TEST
    [root@rhel ~]# find . -iname TEST
    ./test
    ./TEST

    记忆力开始衰减了,所以还是落下笔,尽管很简单。

  • 相关阅读:
    ionic 白名单
    简单的apk Ionic
    Ionic 小节
    Ionic学习笔记四 一些问题处理
    Android Platform Guide
    Android各个版本 版本号对应关系表
    JBPM4.4_管理流程定义
    JBPM4.4_核心概念与相关API
    工作流JBPM_day01:3-使用JBPM的API添加与执行流程
    工作流JBPM_day01:2-HelloWorld
  • 原文地址:https://www.cnblogs.com/ritchy/p/11792299.html
Copyright © 2011-2022 走看看