How to get the last modified time of a file in Linux?


While I was writing a shell script, I needed the last modified time of a particular file before doing something, and here’s what I used:

stat -c ‘%Y’ /root/directory/file.txt

This command will give you the last modified time of a file in seconds (since Epoch).

About these ads

About this entry