find atime/ctime/mtime 探究

  • atime,access time,文件被读取或者执行的时间,修改文件不会改变access time。
  • ctime, change time,文件状态改变的时间,指文件的i节点被修改的时间,如通过chmod修改文件的属性,ctime就会被改变。
  • mtime:modify time,文件内容被修改的时间。
  1. 可以使用 stat 命令查看文件的 atime,ctime,mtime
  2. 也可以使用 ls 查看文件的atime,ctime,mtime
    ls -l 查看文件的mtime
    ls -lu 或者 ls -l -time=atime 查看文件的atime
    ls -lc 或者 ls -l -time=ctime 查看文件的ctime

find -mtime 中的参数n

find . -mtime n 中的n指的是 24(h)* n

  • +n:大于n
  • -n:小于n
  • n:等于n

最后一次修改发生在n天以内
find . -mtime -n