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 by anonymous

1 Answer

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

%y
    time of last modification, human-readable 
%Y
    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 
1498455186
answered Jun 25 by Eric Z Ma (42,250 points)

Please log in or register to answer this question.

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

...