I seek to find files made after a specific time similar to how this command does it:

find . -type f -newermt '1/30/2017 0:00:00'

except instead of a date, and time, string, I need the time stamp to be in epoch time as read from the EPOCHSECONDS system variable. Can this be done? Or will it be necessary to convert EPOCHSECONDS to a date and time string?

I am asking because in a shell script I need to set a variable value equal to EPOCHSECONDS, do some commands that will make changes to unknown files, and then use the find command to see what files those commands changed.

  • It might be more straightforward to just touch a temporary file, do your commands, then find files simply -newer than the temporary file. Jan 27 at 18:15

1 Answer 1


Yes it can.

The -newerXY entry of man find tells us that

Time specifications are interpreted as for the  argument
to  the -d option of GNU date.

and from the info 'date input formats' node:

29.9 Seconds since the Epoch

If you precede a number with ‘@’, it represents an internal timestamp as a count of seconds. The number can contain an internal decimal point (either ‘.’ or ‘,’); any excess precision not supported by the internal representation is truncated toward minus infinity. Such a number cannot be combined with any other date item, as it specifies a complete timestamp.

So for example

find . -type f -newermt @1485752400


secs=$(date +%s -d '1/30/2017 0:00:00')
find . -type f -newermt "@$secs"
  • Thank you for your reply. The epoch time I need to pass to find will be stored in a variable. The example you have given uses a numeric literal. By what syntax can a variable containing an epoch time value be passed to find? Can this variable be prefixed by @ just as the literal is in your example?
    – Stephen
    Jan 26 at 21:54
  • 1
    @Stephen yes it can - see edit Jan 26 at 22:08

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.