How to get the mtime of a file on Linux?

How to get the mtime of a file on Linux from the file's path?

asked Jun 19, 2017 by anonymous

1 Answer

You can use stat to get the file status including the mtime:

    time of last modification, human-readable 
    time of last modification, seconds since Epoch

As an example,

$ stat -c %y ./file 
2017-06-26 13:33:06.764042064 +0800
$ stat -c %Y ./file 
answered Jun 25, 2017 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost