location of popup helpers question

James Wilkinson fedora at aprilcottage.co.uk
Wed Oct 7 21:00:28 UTC 2009


Rick Stevens wrote:
> Uh, doesn’t “ls” show the mtime (modify time) by default?

Anne Wilson replied:
> AIUI, reading a file is an access - in fact if you open a text file anywhere 
> on your computer then close it without any change you will see the timestamp 
> get updated.  That does not mean it has been written to.

Actually, on classic Unix there are three timestamps.
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Global_File_System_2/s1-manage-atimeconf.html
says:
    Each file inode and directory inode has three time stamps
    associated with it:

     * ctime — The last time the inode status was changed
     * mtime — The last time the file (or directory) data was modified
     * atime — The last time the file (or directory) data was accessed 

ls -l by default will show the mtime¹. So if the time reported by ls -l
changes, then the file has been written (which is not necessarily to say
that the contents have changed).

Note that atime may not be reliable on your systems, since it impacts
performance. The same link says:

    Two methods of reducing the effects of atime updating are
    available:

     * Mount with relatime (relative atime), which updates the
       atime if the previous atime update is older than the mtime or
       ctime update.
     * Mount with noatime, which disables atime updates on that file
       system. 

I think these days Fedora uses
relatime by default, so many users won’t see what you saw unless their
text editor insists on saving when closing a file.

Hope this helps,

James.

¹ See, for example,
info coreutils "What information is listed"
which says
     … print the … timestamp … normally the modification time.

-- 
E-mail:     james@ | “We completely deny the allegations, and we’re trying to
aprilcottage.co.uk | identify the alligators.”




More information about the fedora-list mailing list