find -daystart 参数解释

发布于 2024-09-16 20:30:45 字数 623 浏览 0 评论 0原文

所以我理解这样一行:

find /var/log/ -mtime +60 -type f -exec ls -l {} \;

将列出 /var/log 中 60 天或更早修改的所有文件。

阅读 find 手册页后,我注意到:

 Measure  times  (for  -amin,  -atime,  -cmin, -ctime, -mmin, and 
 -mtime) from the beginning of today rather than  from  24  hours
 ago.   This  option only affects tests which appear later on the
 command line.

有人可以解释其余的内容吗? (-amin、-atime、-cmin、-ctime、-mmin)手册页本身似乎并没有真正声明它们各自的作用?

一些可能帮助我理解的示例问题:

  • 查找一小时或更长时间前修改的文件?
  • 查找 60 分钟到 10 分钟前修改的文件?
  • 查找 2 周前修改的文件?
  • 查找最近 5 分钟内创建的文件?

So I understand that a line such as:

find /var/log/ -mtime +60 -type f -exec ls -l {} \;

Will list all files in /var/log which were modified 60 days or more ago.

After reading through the find man page though I noticed:

 Measure  times  (for  -amin,  -atime,  -cmin, -ctime, -mmin, and 
 -mtime) from the beginning of today rather than  from  24  hours
 ago.   This  option only affects tests which appear later on the
 command line.

Can someone explain the rest? (-amin, -atime, -cmin, -ctime, -mmin) The man page itself does not seem to really declare what each of these do?

Some example questions which might help me understand:

  • Find files modified an hour or more ago?
  • Find files modified between 60 minutes and 10 minutes ago?
  • Find files modified 2 weeks ago?
  • Find files created in the last 5 minutes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软糯酥胸 2024-09-23 20:30:45
  • 查找一小时或更长时间前修改的文件?
-mmin +60
  • 查找 60 分钟到 10 分钟前修改的文件?
-mmin -60 -mmin +10
  • 查找 2 周前修改的文件?
-mtime +7 -mtime -8
  • 查找过去 5 分钟内创建的文件?

做不到。 POSIX 没有创建时间的规范。

这些选项在 find(1) 手册页的 EXPRESSIONS 部分的 TESTS 小节中进行了解释。

  • Find files modified an hour or more ago?
-mmin +60
  • Find files modified between 60 minutes and 10 minutes ago?
-mmin -60 -mmin +10
  • Find files modified 2 weeks ago?
-mtime +7 -mtime -8
  • Find files created in the last 5 minutes?

Can't be done. POSIX has no specification for creation time.

These options are explained in the TESTS subsection of the EXPRESSIONS section of the find(1) man page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文