How to find the files that are created in the last hour in unix

前端 未结 6 1333
栀梦
栀梦 2021-01-29 18:36

How to find the files that are created in the last hour in unix

6条回答
  •  梦谈多话
    2021-01-29 19:15

    UNIX filesystems (generally) don't store creation times. Instead, there are only access time, (data) modification time, and (inode) change time.

    That being said, find has -atime -mtime -ctime predicates:

    $ man 1 find
    ...
    -ctime  n
            The primary shall evaluate as true if the time of last change of
            file status information subtracted from the initialization time,
            divided by 86400 (with any remainder discarded), is n.
    ...
    

    Thus find -ctime 0 finds everything for which the inode has changed (e.g. includes file creation, but also counts link count and permissions and filesize change) less than an hour ago.

提交回复
热议问题