How to get the mtime of a file on Linux?
Posted on In QAHow to get the mtime
of a file on Linux from the file’s path?
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