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

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

  • 相关阅读:
    IOS手机 html5页面 数字变成蓝色链接的原因
    html5预加载图片的写法
    jquery取消绑定的方法
    CSS3幸运大转盘最简单的写法
    深度搜索应用之黑白图像(非递归)
    springday03-go1
    springday02-go4
    spring day02-go3
    springday02-go2
    spring da-y02-go1
  • 原文地址:https://www.cnblogs.com/ritchy/p/11792299.html
Copyright © 2011-2022 走看看