How does time be measured in find
Issue
How does time be measured in find? e.g. if current time is Nov 14 14:30, why running "find . -mtime 1" would get the files that its mtime is between Nov 12 and Nov 13
[root@localhost find]# date
Wed Nov 14 14:30:00 HKT 2012
[root@localhost find]# ll
total 0
-rw-r--r--. 1 root root 0 Nov 10 09:00 file-2012Nov10_0900
-rw-r--r--. 1 root root 0 Nov 10 17:00 file-2012Nov10_1700
-rw-r--r--. 1 root root 0 Nov 11 09:00 file-2012Nov11_0900
-rw-r--r--. 1 root root 0 Nov 11 17:00 file-2012Nov11_1700
-rw-r--r--. 1 root root 0 Nov 12 09:00 file-2012Nov12_0900
-rw-r--r--. 1 root root 0 Nov 12 17:00 file-2012Nov12_1700
-rw-r--r--. 1 root root 0 Nov 13 09:00 file-2012Nov13_0900
-rw-r--r--. 1 root root 0 Nov 13 17:00 file-2012Nov13_1700
-rw-r--r--. 1 root root 0 Nov 14 09:00 file-2012Nov14_0900
-rw-r--r--. 1 root root 0 Nov 14 2012 file-2012Nov14_1700
[root@localhost find]# find /root/find/ -mtime +1 | sort
/root/find/file-2012Nov10_0900
/root/find/file-2012Nov10_1700
/root/find/file-2012Nov11_0900
/root/find/file-2012Nov11_1700
/root/find/file-2012Nov12_0900
[root@localhost find]# find /root/find/ -mtime -1 | sort
/root/find/
/root/find/file-2012Nov13_1700
/root/find/file-2012Nov14_0900
/root/find/file-2012Nov14_1700
[root@localhost find]# find /root/find/ -mtime 1 | sort
/root/find/file-2012Nov12_1700
/root/find/file-2012Nov13_0900
Environment
- Red Hat Enterprise Linux
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.