Friday, May 9, 2008

Demystifying File Attributes

Unix based operating systems store three attributes regarding file access and modification. At least one of these attributes is a common source of confusion, and while it's generally a harmless mistake to misinterpret it's meaning, knowing what it actually means could save you some headache down the road.

atime (access time):

This is the last time a file was accessed or read. It's also updated when a file is executed.

view with: ls -lu

mtime (modification time):

This is updated whenever a file is modified.

view with: ls -l

ctime (change time):

This attribute is regularly confused for "creation time", which is totally wrong. It's actually not possible to determine a file's creation time on a Unix based OS. Rather, ctime actually means "change time". This flag is set whenever a files owner or permissions change or when the contents change.

view with: ls -lc

No comments: