Why is “find -mtime +2” not showing files older than 48 hours
Any idea why -mtime +2 didn't return test file. What I understand is +2 will return all file older than 48 Hrs.
$ pwd /tmp/20122020 $ ls -rlt total 0 -rw-rw-r-- 1 dmsjboss dmsjboss 0 Dec 17 21:34 test $ $ date Sun Dec 20 10:08:27 +04 2020 $ $ find . -name "test" -mtime +2 $ $ $ $ find . -name "test" -mtime +1 ./test $3
1 Answer
Because the file wasn't 3 days old when you ran the test, it was only two "full" days old.
man findwould have shown you
File was last accessed less than, more than or exactly n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.
This is valid for mtime too
1