find 命令中 ctime 1 和 ctime +1 的区别

find 命令中 ctime 1 和 ctime +1 的区别

如果我运行以下命令:

find . -name "*.jar" -type f -ctime +1

我没有得到任何结果,而如果我运行:

find . -name "*.jar" -type f -ctime 1

我得到结果。

答案1

这意味着目录中的所有 jar 文件在不到 48 小时前都有状态更改。

详细解释

根据find手册页,

-ctime n
    File's status was last changed n*24 hours ago.

和 ...

When find figures out how many 24-hour periods ago the file was 
last accessed, any fractional part is ignored, so to match -atime +1, 
a file has to have been accessed at least two days ago.

而其他地方...

+n for greater than n

因此-ctime +1意味着文件状态必须至少在 48 小时前发生更改。

相关内容