Mtime: Difference between revisions
From Hackepedia
Jump to navigationJump to search
No edit summary |
mNo edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Time of last modification of a file | Time of last modification of a file (e.g. the data in the file has changed). The information is taken from the [[inode]]. | ||
$ stat -s | $ stat -s [[variables|$file]] | tr ' ' '\n' | grep mtime | ||
st_mtime=1130490970 | st_mtime=1130490970 | ||
$ date -r 1130490970 | $ date -r 1130490970 | ||
Fri Oct 28 11:16:10 CEST 2005 | Fri Oct 28 11:16:10 CEST 2005 | ||
$ ls -lT | $ ls -lT [[variables|$file]] | ||
-rw-r--r-- 1 root wheel 33554432 Oct 28 11:16:10 2005 | -rw-r--r-- 1 root wheel 33554432 Oct 28 11:16:10 2005 file | ||
If a file has been modified the mtime will change to that date. The mtime can be changed in a file: | If a file has been modified the mtime will change to that date. The mtime can be changed in a file: | ||
Line 12: | Line 12: | ||
# date -r 0 | # date -r 0 | ||
Thu Jan 1 01:00:00 CET 1970 | Thu Jan 1 01:00:00 CET 1970 | ||
# touch -mt 197001010100.01 | # touch -mt 197001010100.01 [[variables|$file]] | ||
# ls -lT | # ls -lT [[variables|$file]] | ||
-rw-r--r-- 1 root wheel 33554432 Jan 1 01:00:01 1970 | -rw-r--r-- 1 root wheel 33554432 Jan 1 01:00:01 1970 file | ||
When a files mtime is changed the [[ctime]] will update naturally to the date when this happened. | When a files mtime is changed the [[ctime]] will update naturally to the date when this happened. |
Latest revision as of 11:02, 27 January 2006
Time of last modification of a file (e.g. the data in the file has changed). The information is taken from the inode.
$ stat -s $file | tr ' ' '\n' | grep mtime st_mtime=1130490970 $ date -r 1130490970 Fri Oct 28 11:16:10 CEST 2005 $ ls -lT $file -rw-r--r-- 1 root wheel 33554432 Oct 28 11:16:10 2005 file
If a file has been modified the mtime will change to that date. The mtime can be changed in a file:
# date -r 0 Thu Jan 1 01:00:00 CET 1970 # touch -mt 197001010100.01 $file # ls -lT $file -rw-r--r-- 1 root wheel 33554432 Jan 1 01:00:01 1970 file
When a files mtime is changed the ctime will update naturally to the date when this happened.