我挣扎来包装我的脑海里围绕为什么在find
解释文件修改时间它的方式。具体来说,我不明白为什么-mtime +1
不显示小于 48 小时的文件。
作为示例测试,我创建了三个具有不同修改日期的测试文件:
[root@foobox findtest]# ls -l
total 0
-rw-r--r-- 1 root root 0 Sep 25 08:44 foo1
-rw-r--r-- 1 root root 0 Sep 24 08:14 foo2
-rw-r--r-- 1 root root 0 Sep 23 08:14 foo3
Run Code Online (Sandbox Code Playgroud)
然后我用-mtime +1
开关运行 find并得到以下输出:
[root@foobox findtest]# find -mtime +1
./foo3
Run Code Online (Sandbox Code Playgroud)
然后我运行 find-mmin +1440
并得到以下输出:
[root@foobox findtest]# find -mmin +1440
./foo3
./foo2
Run Code Online (Sandbox Code Playgroud)
根据 find 的手册页,我知道这是预期的行为:
-mtime n
File’s data was last modified n*24 hours ago. …
Run Code Online (Sandbox Code Playgroud) 当我发出:
find / \( -type f -size +10M \) -and \( -type f -size -1G \)
Run Code Online (Sandbox Code Playgroud)
我没有收到任何结果;但是,当我输入:
find / \( -type f -size +10M \) -and \( -type f -size -1000M \)
Run Code Online (Sandbox Code Playgroud)
它返回几个文件。
怎么了?我不能在操作员的两侧使用不同的测量单位-and
吗?