ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20150624]find使用.txt

[20150624]find使用.txt

原创 Linux操作系统 作者:lfree 时间:2015-06-24 10:46:50 0 删除 编辑

[20150624]find使用.txt

--find 命令是linux下自己经常使用的命令。我自己经常使用,但是参数里面的-mtime +N/N/-N,每次都给看文档。
--首先看看:
Numeric arguments can be specified as
+n     for greater than n,
-n     for less than n,
n      for exactly n.

-- 如果-mtime +2 表示当前时间-2day以前的mtime的文件。即文件 sysdate -2  > mtime .
-- 如果-mtime -2 表示当前时间-2day以后的mtime的文件。即文件 sysdate -2  < mtime .
-- 如果-mtime  2 在我看来最容易混淆,表示文件mtime在sysdate -2 与 sysdate-1 之间的文件。
-- 实际上再记不住,记住一般删除旧数据,一定是选择+。

--find还有一个不常用的用法:

touch -t '201506240800' /tmp/start_of_20150624
touch -t '201506241000' /tmp/end_of_20150624
find . -newer /tmp/start_of_20150624 ! -newer /tmp/end_of_20150624 -print

--这样可以查询2015-06-24 8点~10点之间修改的文件。

--find 记录文件的权限:
find /u01/app/oracle/ -printf 'chown %u:%g %p\n'
find /u01/app/oracle/ -printf 'chmod %m %p\n'

--特此做一个记录。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-1710169/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7971888