您的位置:首页 > 运维架构 > Linux

关于LINUX三种时间戳的详细说明(带实验)

2018-03-11 19:54 330 查看
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==》时间戳改变
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: