我挣扎来包装我的脑海里围绕为什么在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)