On Unix, is there a command to display a file's modification time, precise to the second?
On Linux this is easily done with a "stat -c %y", which returns something like 2009-11-27 11:36:06.000000000 +0100
. I found no equivalent on Unix.
The modified time is when a file last had its contents modified. And the change time is when a file last had its metadata changed (such as file permissions or the name of the file).
The syntax is pretty simple; just run the stat command followed by the file's name whose last modification date you want to know, as shown in the example below. As you can see, the output shows more information than previous commands. It is important to differentiate the modification and change dates.
I found this:
ls --time-style='+%d-%m-%Y %H:%M:%S' -l
Which exports something like this:
root:~# ls --time-style='+%d-%m-%Y %H:%M:%S' -l total 0 -rw-r--r-- 1 root root 0 16-04-2015 23:14:02 other-file.txt -rw-r--r-- 1 root root 0 16-04-2015 23:13:58 test.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With