Mtime: Difference between revisions

From Hackepedia
Jump to navigationJump to search
Frankk (talk | contribs)
No edit summary
Frankk (talk | contribs)
No edit summary
Line 1: Line 1:
Time of last modification of a file, the information is taken from the [[inode]].
Time of last modification of a file, the information is taken from the [[inode]].


  $ stat -s [[variables|$disk]] | tr ' ' '\n' | grep mtime
  $ stat -s [[variables|$file_or_diskname]] | tr ' ' '\n' | grep mtime
  st_mtime=1130490970
  st_mtime=1130490970
  $ date -r 1130490970
  $ date -r 1130490970

Revision as of 11:43, 28 October 2005

Time of last modification of a file, the information is taken from the inode.

$ stat -s $file_or_diskname | tr ' ' '\n' | grep mtime
st_mtime=1130490970
$ date -r 1130490970
Fri Oct 28 11:16:10 CEST 2005
$ ls -lT disk
-rw-r--r--  1 root  wheel  33554432 Oct 28 11:16:10 2005 disk

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 disk
# ls -lT disk                     
-rw-r--r--  1 root  wheel  33554432 Jan  1 01:00:01 1970 disk

When a files mtime is changed the ctime will update naturally to the date when this happened.