加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

unix – “find command -mtime 0”没有得到我期望的文件

发布时间:2020-12-16 01:10:31 所属栏目:安全 来源:网络整理
导读:我试图找到一个0天的文件.以下是我为测试它而执行的步骤 $ls$ls -ltrtotal 0$touch tmp.txt$ls -ltrtotal 0-rw-r----- 1 tstUser tstUser 0 Feb 28 20:02 tmp.txt$find * -mtime 0$$find * -mtime -1tmp.txt$ 为什么’-mtime 0’没有给我这个文件? ‘-mtime
我试图找到一个0天的文件.以下是我为测试它而执行的步骤
$ls
$ls -ltr
total 0
$touch tmp.txt
$ls -ltr
total 0
-rw-r-----   1 tstUser tstUser           0 Feb 28 20:02 tmp.txt
$find * -mtime 0
$
$find * -mtime -1
tmp.txt
$

为什么’-mtime 0’没有给我这个文件?

‘-mtime 0’和’-mtime -1’之间的确切区别是什么?

我确定必须有其他方法可以在unix中找到0天的文件,但我很好奇这个’-mtime’实际上是如何工作的.

-mtime n
          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.

因此,-mtime 0将等于:“文件的数据是在0小时前修改的.
虽然-mtime 1将是:“文件的数据最后修改时间为24小时前”

编辑:

Numeric arguments can be specified as

   +n     for greater than n,-n     for less than n,n      for exactly n.

所以我猜-1会在过去24小时内被修改,而1则恰好是一天.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读