태그: ,

mtime, atime 그리고 ctime

가끔 ctime을 creation time으로 착각할 때가 많다. 다시 한 번 ctime은 change time임을 상기하면서 잘 정리된 문서를 링크한다.

What is the difference between mtime, atime and ctime?

mtime
mtime (modification time) indicates the time the contents of the file has been changed. Mind you, only the contents. Not the attributes. For instance, if you open a file and change some (or all) of its content, its mtime gets updated. If you change a file’s attribute (like read-write permissions, metadata), its mtime doesn’t change, but ctime will.
atime
atime (access time) is the timestamp that indicates the time that a file has been accessed. The file may have been opened by you, or may have been accessed by some other program or a remote machine. Anytime a file has been accessed, its access time changes.
ctime
ctime (change time) is the timestamp of a file that indicates the time that it was changed. Now, the modification can be in terms of its content or in terms of its attributes. Whenever anything about a file changes (except its access time), its ctime changes.

간단히 정리하자면 다음과 같다.

mtime
마지막으로 파일의 내용을 바꾼 시간
atime
마지막으로 파일의 내용에 접근한 시간; 시스템의 성능향상을 위해 리눅스 커널 2.6.30부터는 relatime을 기본 마운트 옵션으로 사용한다. 기본 마운트 옵션을 사용할 경우 실시간으로 바뀌는 정보가 아니기 때문에 atime에 의존하지는 말자.
ctime
마지막으로 파일의 내용이나 메타데이터를 바꾼 시간

참고문헌

이 칸을 비워 두세요.