例如,我有两个文件
-rw-rw---- 1 1000 1000 5 Sep 28 01:25 file1 -rw-rw---- 1 1000 1000 13 Sep 28 01:25 file2
在echo "asdfg" >> file1 (file1内容被修改)之后,
-rw-rw---- 1 1000 1000 11 Sep 28 01:25 file1 -rw-rw---- 1 1000 1000 13 Sep 28 01:25 file2
和chmod 770 file2 (文件2元已更改)
-rw-rw---- 1 1000 1000 11 Sep 28 01:25 file1 -rwxrwx--- 1 1000 1000 13 Sep 28 01:25 file2
运行find . -mmin -5 find . -mmin -5在5分钟内,结果如预期,因为只有file1被修改
./file1
试过find . -cmin -5 find . -cmin -5然后我得到了这个
./file2 ./file1
请帮助我如何使用find列出权限更改只有一个?
如果时间戳在每种情况下都是正确的,那么从创build文件起,它看起来还不到五分钟,这意味着ctimetesting会因为这个原因而触发。 值得注意的是,当你编辑它时,file1上的时间戳不会改变,表明它在创build(或者上次编辑)的同一分钟内发生。
否则你的语法似乎正确。 下面是我的系统(RHEL 7.4)的一个简单例子,用时间戳来说明:
[testuser@dc0sandbox01 ~]$ date Thu Sep 28 10:36:53 CEST 2017 [testuser@dc0sandbox01 ~]$ touch file1 [testuser@dc0sandbox01 ~]$ touch file2 [testuser@dc0sandbox01 ~]$ find . -cmin -1 . ./file1 ./file2 [testuser@dc0sandbox01 ~]$ date Thu Sep 28 10:37:09 CEST 2017 (wait for a minute) [testuser@dc0sandbox01 ~]$ date Thu Sep 28 10:38:11 CEST 2017 [testuser@dc0sandbox01 ~]$ find . -cmin -1 [testuser@dc0sandbox01 ~]$ chmod 660 file1 [testuser@dc0sandbox01 ~]$ find . -cmin -1 ./file1 [testuser@dc0sandbox01 ~]$ date Thu Sep 28 10:38:26 CEST 2017
如果仍有问题,请尝试使用stat命令来显示每个文件的详细信息:
[testuser@dc0sandbox01 ~]$ stat file1 File: 'file1' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fd02h/64770d Inode: 286973 Links: 1 Access: (0660/-rw-rw----) Uid: (10131/testuser) Gid: (10131/testuser) Context: unconfined_u:object_r:user_home_t:s0 Access: 2017-09-28 10:36:56.331274189 +0200 Modify: 2017-09-28 10:36:56.331274189 +0200 Change: 2017-09-28 10:38:21.872727064 +0200 Birth: -