Skip to content

ctime, mtime, atime 다른 점 설명

조회 수 5987 추천 수 0 2014.02.07 17:28:09

참고 : http://www.linux-faqs.info/general/difference-between-mtime-ctime-and-atime


우리는 대체로 이렇게 생각한다.

ctime : create time , mtime = modify time , atime = access time 이라고 생각한다. 

하지만 이렇게 생각하면 안된다.


ctime : 파일이나 inode 값이 바뀐 시점이다. 다시말해 속성값이 바뀐시점이다. 퍼미션이나 소유주, 파일크기 등 파일 속성값이 변경되었을 때 ctime 은 갱신된다.

mtime : 파일의 수정시간이다. 이는 속성이 아닌 파일의 내용이 바뀌었을때 이 값이 바뀐다. 주의할 것은 파일 내용이 바뀌면 파일의 크기가 달라진다. 이때 파일의 크기가 속성이므로 ctime도 갱신된다. 만약 파일 내용을 수정했는데 파일 크기가 바뀌지 않았을수 있다. 이때는 ctime이 바뀌지 않을까? 파일이 수정되면 mtime 이 바뀐다. mtime 은 파일의 속성이다. 때문에 ctime이 바뀐다.

** mtime은 대체로 ctime 과 같다. mtime이 갱신되면 ctime도 갱신된다. 하지만 ctime이 변경된다고 mtime이 변경되지는 않는다.

atime : 파일을 오픈하면 atime이 갱신된다. grep , sort, cat 등등 명령을 주거나 open() 함수로 열었을때 



파일의 ctime, mtime, atime을 쉘에서 ls로 확인법

ls의 옵션으로 -u 는 atime, -c는 ctime,  옵션이 없다면 mtime을 출력한다.

-u 와 -c 는 동시에 사용될 수 없다.




A common mistake is that ctime is the file creation time. This is not correct, it is the inode/file change time. mtime is the file modification time. A often heard question is "What is the ctime, mtime and atime?".This is confusing so let me explain the difference between ctime, mtime and atime.

ctime

ctime is the inode or file change time. The ctime gets updated when the file attributes are changed, like changing the owner, changing the permission or moving the file to an other filesystem but will also be updated when you modify a file.

mtime

mtime is the file modify time. The mtime gets updated when you modify a file. Whenever you update content of a file or save a file the mtime gets updated.

 

Most of the times ctime and mtime will be the same, unless only the file attributes are updated. In that case only the ctime gets updated.

atime

atime is the file access time. The atime gets updated when you open a file but also when a file is used for other operations like grep, sort, cat, head, tail and so on.

profile

일요일은 짜빠게뤼~ 먹는날~^^

엮인글 :
http://adminplay.com/253485/914/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
27 외국 자료실 (Unix Linux Windows) ADMINPLAY 2009-02-04 18930
26 파일시스템 체크 ADMINPLAY 2009-01-22 20163
25 top 명령어 정리 ADMINPLAY 2009-01-10 18650
24 콘솔에서 로그인이 안될때 ADMINPLAY 2008-12-29 21289
23 OS 종류 및 버전확인 ADMINPLAY 2008-12-23 21729
22 마우스 오른쪽 버튼 막기... ADMINPLAY 2008-12-14 19105
21 /var 디렉토리 용량이 갑자기!!! ADMINPLAY 2008-12-14 20270
20 CentOS 5 32bit에서 메모리 4G 지원하기 ADMINPLAY 2008-12-10 20883
19 single mode readonly 파티션 rw로 다시 마운트 ADMINPLAY 2008-12-10 23354
18 실시간 접근정보 확인 ADMINPLAY 2008-12-10 22122
17 kernel panic 발생 시 자동으로 리부팅 설정 ADMIN 2008-12-10 24127
16 서버 점검 : 자원 및 apache, mysql ADMIN 2008-12-10 23513
15 리눅스에서 실수로 삭제한 파일을 복구 ADMIN 2008-12-10 23636
14 각종 데몬 이름 및 설명 ADMIN 2008-11-25 13825
13 리눅스 - 하드디스크 추가, 파티션 및 마운트 ADMIN 2008-11-12 18315
12 리눅스 전원부터 부팅이 되기까지의 과정이해 ADMIN 2008-11-11 59031
11 Maskrading ADMIN 2008-11-11 60193
10 강제로 언마운트 하기 ADMIN 2008-11-11 20542
9 부분적으로 yum 업데이트 하고 싶을때 ADMIN 2008-11-10 17118
8 리눅스에서 계정 생성시 자동으로 디렉토리가 생성되게 하... ADMIN 2008-11-04 21658

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234