【发布时间】:2014-10-25 11:44:43
【问题描述】:
我在家里创建了一个文件夹,并在里面触摸了一个文件。现在我正在执行
find /home -mtime 1
但它没有找到任何东西。这正常吗?
【问题讨论】:
我在家里创建了一个文件夹,并在里面触摸了一个文件。现在我正在执行
find /home -mtime 1
但它没有找到任何东西。这正常吗?
【问题讨论】:
你需要使用:
find /home -mtime -1
根据man find:
-mtime n[smhdw]
If no units are specified, this primary evaluates to true if the difference between
the file last modification time and the time find was started, rounded up to the next
full 24-hour period, is n 24-hour periods.
If units are specified, this primary evaluates to true if the difference between the
file last modification time and the time find was started is exactly n units.
【讨论】:
您必须根据需要将+ 或- 添加到整数值。系统无法理解1默认为+1
【讨论】:
1 表示修改时间正好等于 1 天,而 +1 表示修改时间大于 1 天。 linux 中的 1 天是从当前时间开始的 24 小时持续时间,而不是日期的差异。