ファイルのatime/ctime/mtimeってなに?

» 2002年08月28日 21時39分 公開
[木田佳克ITmedia]

この記事は会員限定です。会員登録すると全てご覧いただけます。

 UNIX系のシステムでは、ファイルの持つタイムスタンプ情報に「修正時間」(mtime)、「作成時間」(ctime)、「アクセス時間」(atime)情報がある。それぞれには、次のような条件で管理されている。

■ファイルが持つ3つの時間

atime アクセス時間 指定日数内にアクセスされたファイル
ctime 作成時間 指定日数内に属性変更されたファイル
mtime 修正時間(iノード管理) 指定日数内に修正、更新されたファイル

 この時間管理の一端を見るには、例えば次のようなtouchコマンドで確認が可能だ。

# touch a.txt
# touch m.txt
# ls -l
合計 0
-rw-r--r-- 1 root root    0 8月 28日 20:34 a.txt
-rw-r--r-- 1 root root    0 8月 28日 20:34 m.txt
数分後...
# touch -m m.txt
# touch -a a.txt
# ls -l
合計 0
-rw-r--r-- 1 root root    0 8月 28日 20:34 a.txt
-rw-r--r-- 1 root root    0 8月 28日 20:36 m.txt

Copyright © ITmedia, Inc. All Rights Reserved.

注目のテーマ