10

I know I can use this option to find file between particular modified times. But I'm curious about what does this mean?

I used man find | grep newermt trying to find something. But I got no direct content. It seems -newer file and mtime stuff may have relation with it. But I'm not sure..

So, what does -newermt actually mean?

17

find(1):

-newerXY reference
          Compares the timestamp of the current file with reference.   The
          reference  argument  is  normally the name of a file (and one of
          its timestamps is used for the comparison) but it may also be  a
          string  describing  an  absolute time.  X and Y are placeholders
          for other letters, and these letters select which time belonging
          to how reference is used for the comparison.

          a   The access time of the file reference
          B   The birth time of the file reference
          c   The inode status change time of reference
          m   The modification time of the file reference
          t   reference is interpreted directly as a time
10

find ./ -mtime +n used to get all files older than n days
find ./ -mtime -n used to get all files modified in last n days
Now if you are using 1 in place of n, you will get files modified in the last 24 hours. But what if you want only files from yesterday and not within the last 24 hours? Here newermt comes into the picture.

find ./ -newermt "2016-01-18" ! -newermt '2016-01-19'

will give you all files which are newer than specified date and ! will exclude all files which are newer than the specified date. So the above command will give a list of files which were modified on 2016-01-18.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.