Linux系统将时间标记分三类:

atime( A ccess time):档案上次被读取的时间。

ctime(status C hange time):档案的属性或内容上次被修改的时间。

mtime( M odified time):档案的内容上次被修改的时间。

下面我将用实验给大家讲解一下:

[root@localhost ~]# touch a.txt  ==》创建文件a.txt

[root@localhost ~]# stat a.txt    ==》查看时间戳

  File: "a.txt"

  Size: 0         Blocks: 0          IO Block: 4096   普通空文件

Device: fd00h/64768dInode: 674903      Links: 1

Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2018-03-10 13:29:04.130157512 +0800

Modify: 2018-03-10 13:29:04.130157512 +0800

Change: 2018-03-10 13:29:04.130157512 +0800

[root@localhost ~]# echo 1>> a.txt  ==》向文件a.txt追加内容

[root@localhost ~]# stat a.txt   ==》查看追加内容后的文件时间戳

  File: "a.txt"

  Size: 1         Blocks: 8          IO Block: 4096   普通文件

Device: fd00h/64768dInode: 674903      Links: 1

Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2018-03-10 13:29:04.130157512 +0800

Modify: 2018-03-10 13:29:19.351159892 +0800  ==》时间戳改变

Change: 2018-03-10 13:29:19.351159892 +0800  ==》时间戳改变           

[root@localhost ~]# chmod +x a.txt  ==》修改文件a.txt的权限

[root@localhost ~]# stat a.txt  ==》查看修改权限后的文件时间戳

  File: "a.txt"

  Size: 1         Blocks: 8          IO Block: 4096   普通文件

Device: fd00h/64768dInode: 674903      Links: 1

Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2018-03-10 13:29:04.130157512 +0800

Modify: 2018-03-10 13:29:19.351159892 +0800

Change: 2018-03-10 13:29:42.156153774 +0800 ==》时间戳改变

[root@localhost ~]# cat a.txt  ==》查看文件a.txt

 

[root@localhost ~]# stat a.txt  ==》查看文件a.txt的时间戳

  File: "a.txt"

  Size: 1         Blocks: 8          IO Block: 4096   普通文件

Device: fd00h/64768dInode: 674903      Links: 1

Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2018-03-10 13:30:00.010155999 +0800 ==》时间戳改变

Modify: 2018-03-10 13:29:19.351159892 +0800

Change: 2018-03-10 13:29:42.156153774 +0800

[root@localhost ~]# vim a.txt  ==》向文件a.txt添加内容

daskhdjkas

"a.txt" 1L, 11C 已写入

[root@localhost ~]# stat a.txt   ==>查看文件a.txt的时间戳

  File: "a.txt"

  Size: 11        Blocks: 8          IO Block: 4096   普通文件

Device: fd00h/64768dInode: 674908      Links: 1

Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2018-03-10 13:30:34.652158960 +0800 ==》时间戳改变

Modify: 2018-03-10 13:30:34.652158960 +0800==》时间戳改变

Change: 2018-03-10 13:30:34.653158940 +0800==》时间戳改变

友情链接
ioDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信