find 参数mtime用法

+1 表示 1 * 24小时 再加+24小时以外,相当于当前时间48小时前(2天前)
1 表示 1 * 24小时 再加+24小时之间,相当于当前时间48小时前--当前时间24小时前(前天-昨天)
0 表示 0 * 24小时 + 24 到 0 之间,相当于当天的

+1 表示 1 * 24 再加+24小时以外,相当于当前时间48小时前(2天前)

[root@k8s-node01 test]# date
2020年 07月 24日 星期五 17:24:02 CST
[root@k8s-node01 test]# find /opt/test -type f -mtime +1 -name "*.txt" -exec ls -al {} \;
-rw-r--r--. 1 root root 0 7月 22 17:23 /opt/test/date0722-01.txt
-rw-r--r--. 1 root root 0 7月 22 17:23 /opt/test/date0722-02.txt
-rw-r--r--. 1 root root 0 7月 22 17:23 /opt/test/date0722-03.txt
-rw-r--r--. 1 root root 0 7月 19 17:24 /opt/test/date0719-01.txt
-rw-r--r--. 1 root root 0 7月 19 17:24 /opt/test/date0719-02.txt
-rw-r--r--. 1 root root 0 7月 19 17:24 /opt/test/date0719-03.txt
-rw-r--r--. 1 root root 0 7月 20 17:23 /opt/test/date0720-01.txt
-rw-r--r--. 1 root root 0 7月 20 17:23 /opt/test/date0720-02.txt
-rw-r--r--. 1 root root 0 7月 20 17:23 /opt/test/date0720-03.txt
-rw-r--r--. 1 root root 0 7月 21 17:23 /opt/test/date0721-01.txt
-rw-r--r--. 1 root root 0 7月 21 17:23 /opt/test/date0721-02.txt
-rw-r--r--. 1 root root 0 7月 21 17:23 /opt/test/date0721-03.txt

表示 1 * 24 再加+24小时之间,相当于当前时间48小时前--当前时间24小时前(前天-昨天)
[root@k8s-node01 test]# date 2020年 07月 24日 星期五 17:32:25 CST [root@k8s-node01 test]# [root@k8s-node01 test]# find /opt/test -type f -mtime 1 -name "*.txt" -exec ls -al {} \; -rw-r--r--. 1 root root 0 7月 23 17:23 /opt/test/date0723-01.txt -rw-r--r--. 1 root root 0 7月 23 17:23 /opt/test/date0723-02.txt -rw-r--r--. 1 root root 0 7月 23 17:23 /opt/test/date0723-03.txt

猜你喜欢

转载自www.cnblogs.com/wangzy-tongq/p/13374278.html
今日推荐