Skip to content

ctime, mtime, atime 다른 점 설명

조회 수 5953 추천 수 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/807/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수
327 CentOS 6.5 에서 VirtualBox 4.3 설치후 VirtualBox 구동... ADMINPLAY 2014-02-14 7795
326 VirtualBox 4.3 Released – Install on RHEL/CentOS/Fedor... ADMINPLAY 2014-02-14 7272
» ctime, mtime, atime 다른 점 설명 ADMINPLAY 2014-02-07 5953
324 ZFS 파일에 ACL 설정 ADMINPLAY 2014-02-03 5271
323 ll 명령시 날짜 전체가 보이도록 하기 ADMINPLAY 2014-01-02 5431
322 ModSecurity 로그파일의 사이즈가 너무 큰데 이를 날짜나 ... file ADMINPLAY 2013-12-29 6536
321 top 화면 내용중 load average와 PRI : priority(우선순위... ADMINPLAY 2013-12-24 5138
320 hddtemp와 mrtg를 이용한 하드디스크 온도 체크 file ADMINPLAY 2013-12-19 5450
319 tar 압축을 실수로 디렉토리 생성 안하고 풀었을때 대처법 ADMINPLAY 2013-09-22 5386
318 windows smartctl ADMINPLAY 2013-09-22 5273
317 HDD Guardian (a graphical user interface for smartctl) ADMINPLAY 2013-09-22 4951
316 리눅스 벤치마크 프로그램 목록 ADMINPLAY 2013-09-09 7561
315 Adaptec 컨트롤러 StorMan 에러 및 각종 확인 방법 ADMINPLAY 2013-06-12 8984
314 linux 커널 파라메터 수정 ADMINPLAY 2013-05-12 5554
313 특정 데몬의 메모리 점유율 확인하기 ADMINPLAY 2013-05-12 6131
312 make 정리 ADMINPLAY 2013-05-12 5264
311 What are the bandwidth requirements for running a BigB... ADMINPLAY 2013-05-06 5920
310 스트리밍 서비스 위한 각 회사 와우자,어도비,마이크로 ... ADMINPLAY 2013-05-06 9888
309 파일비교 명령어 diff 사용법 ADMINPLAY 2013-05-03 9646
308 웹서버 트래픽 시각화 logstalgia l2zeo 2013-05-03 6090

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234