LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   find's results are perplexing (https://www.linuxquestions.org/questions/fedora-35/finds-results-are-perplexing-4175555964/)

nix84 10-12-2015 06:02 PM

find's results are perplexing
 
I am getting different results from the "find" command and some results that are not explained in the man page.
The command I am using should return the files modified in the last 2 days per the man page: find /var -mtime +1
Problem: regardless it returns 19614 lines of output.
If I change this to -1, -2, -3 I get 112, 115, and 139 lines of output respectively. The man page does not describe the minus parameters but I suspect that these may in fact be the lines modified in 2, 3, 4 days and there is a typo in the manual.
Can someone familiar with this command comment? Thanks

rknichols 10-12-2015 06:20 PM

"find -mtime +1" will return all files with modification times more than 24 hours ago, i.e., everything not modified in the last 24 hours.

The description for the "+" and "-" signs is near the top of the "TESTS" section of the manpage:
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.
What you want is "-mtime -2" for files modified less than 2*24 hours ago.

nix84 10-13-2015 02:24 AM

find's results are perplexing
 
Thanks a bunch that is EXACTLY what I suspected!
I will be checking the man page cuz I read it and it (I thought) was supporting what I had read elsewhere.


All times are GMT -5. The time now is 04:29 PM.