Linux 文件夹中最近的文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4933627/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:46:01  来源:igfitidea点击:

Recent files in folder

linuxunixfilefindlogging

提问by Some Java Guy

I want to check files which are recently added to the folder in unix environment.

我想检查最近添加到 unix 环境中文件夹的文件。

is there any find check

是否有任何查找检查

     find -name 'filename' timestamp last 5 mins ??

采纳答案by dogbane

To locate files modified less than 5 minutes ago

定位不到 5 分钟前修改过的文件

find -name 'filename'  -mmin -5

From the man page:

从手册页:

   -mmin n
          File's data was last modified n minutes ago.

   -mtime n
          File's data was last modified n*24 hours ago.

-mmin is supported under most recent versions of GNU find.

-mmin 受最新版本的 GNU find 支持。

回答by Adnan

To find all files modified in the last 24 hours (last full day) in current directory and its sub-directories:

要在当前目录及其子目录中查找过去 24 小时(最后一整天)内修改的所有文件:

find . -mtime -1 -print

Source

来源

回答by Brian Agnew

In zsh:

zsh 中

ls *(mm-5)   # or 'mh' to detect stuff modified in the last 5 hours etc.