Linux file access time, change time, modify time

分类:OS 2011-08-13 来源 人气:360

Linux file change time and Modify time a lot of people very easily confused, and some Unix reference books are wrong (especially the translation),
Ctime will be understood as create time (creation time), it is nonsense, Linux file system does not record create time, unless the file is created after, no modify, no change, then the file creation time and modify the same time and change time.

[Root @ test200 temp] # stat libnids-1.16.tar.gz
File: `libnids-1.16.tar.gz '
Size: 72309 Blocks: 152 IO Block: 4096 regular file
Device: 302h/770d Inode: 4113144 Links: 1
Access: (0644/-rw-r--r--) Uid: (0 / root) Gid: (0 / root)
Access: 2008-05-27 15:13:03.000000000 +0800
Modify: 2004-03-10 12:25:09.000000000 +0800
Change: 2008-05-27 14:18:18.000000000 +0800

access time is the last time the document was read time. So read a document updates its access time, but time and modify it
change the time did not change. cat, more, less, grep, sed, tail, head these commands will modify the file access time.

change time is the index of the document node (inode) changed (such as location, user attributes, group attributes, etc.);

modify time is the content of the text itself has changed. [Also known as document modify time stamp (timestamp).]

Time when file data was last accessed. Changed by the
following functions: creat (), mknod (), pipe (),
utime (2), and read (2).

Time when data was last modified. Changed by the fol-
lowing functions: creat (), mknod (), pipe (), utime (),
and write (2).

Time when file status was last changed. Time of last modification of file status information.Changed by the
following functions: chmod (), chown (), creat (),
link (2), mknod (), pipe (), unlink (2), utime (), and
write ().

chmod, chown, create, mv and other actions will modify the Linux file change time for the current system time

ls command to see the modify time

Using tools such as wget to download the file, cahnge time will not be modified.

Using tools such as vi to edit a file has been saved, modify time will be modified.

Use ls-l command does not modify the file access time, but the cat command will modify the access time.

ls-lu (show files access time and sort by name)
ls-lc (show files change time and sort by name)
ls-l (show files modify time and sort by name)

If combined with-t parameter, sorted according to the corresponding time display. Together - time-style = long-iso, the file will be the appropriate date when the minutes and seconds displayed all the time.

touch command to change the file access time and modify time for any given time.

modify time to change the system time can not be changed any time. Even with c program to directly read and write inode, does not modify the change time.

Added: vi command modifies the file access time, regardless of whether the contents of files changes; if the file content changes, but also modify the file modify time, access time, and at this time
modify time is different, access time is the time just open the file, modify the contents of the file is saved out of time.

blog comments powered by Disqus


iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.279 (s). 14 q(s)