linux中关于time的三个属性

  • linux中time属性分别为atime,mtime,ctime,如何查看这三个参数值?经过stat命令,可查看详细信息
[root@linux01 ~]# touch test.txt
[root@linux01 ~]# stat test.txt 
  文件:"test.txt"
  大小:0         	块:0          IO 块:4096   普通空文件
设备:803h/2051d	Inode:34384837    硬连接:1
权限:(0644/-rw-r--r--)  Uid:(    0/    root)   Gid:(    0/    root)
最近访问:2017-11-21 16:30:32.367193648 +0800
最近更改:2017-11-21 16:30:32.367193648 +0800
最近改动:2017-11-21 16:30:32.367193648 +0800
建立时间:-

==最近访问(atime) --access time/最近更改(mtime)--modified time/最近改动(ctime)--change time==node

  • 文件的atime在读取文件或执行文件时更改,如cat命令查看文件
[root@linux01 ~]# cat test.txt 
[root@linux01 ~]# stat test.txt 
  文件:"test.txt"
  大小:0         	块:0          IO 块:4096   普通空文件
设备:803h/2051d	Inode:34384837    硬连接:1
权限:(0644/-rw-r--r--)  Uid:(    0/    root)   Gid:(    0/    root)
最近访问:2017-11-21 16:39:48.326453178 +0800
最近更改:2017-11-21 16:30:32.367193648 +0800
最近改动:2017-11-21 16:30:32.367193648 +0800
建立时间:-
  • 文件的mtime在写入文件时更改,随着写入内容ctime也会同步更改
[root@linux01 ~]# cat > test.txt 
this is a test page
[root@linux01 ~]# stat test.txt 
  文件:"test.txt"
  大小:20        	块:8          IO 块:4096   普通文件
设备:803h/2051d	Inode:34384837    硬连接:1
权限:(0644/-rw-r--r--)  Uid:(    0/    root)   Gid:(    0/    root)
最近访问:2017-11-21 16:39:48.326453178 +0800
最近更改:2017-11-21 16:42:29.420011871 +0800
最近改动:2017-11-21 16:42:29.420011871 +0800
建立时间:-
  • 文件的ctime在写入文件、更改全部者、权限或连接设置时随inode内容更改而更改
[root@linux01 ~]# ls -l test.txt 
-rw-r--r-- 1 root root 20 11月 21 16:42 test.txt
[root@linux01 ~]# chmod u+x test.txt 
[root@linux01 ~]# stat test.txt 
  文件:"test.txt"
  大小:20        	块:8          IO 块:4096   普通文件
设备:803h/2051d	Inode:34384837    硬连接:1
权限:(0744/-rwxr--r--)  Uid:(    0/    root)   Gid:(    0/    root)
最近访问:2017-11-21 16:39:48.326453178 +0800
最近更改:2017-11-21 16:42:29.420011871 +0800
最近改动:2017-11-21 16:46:05.344866444 +0800
建立时间:-

==inode(牵引节点)用来存放档案及目录的基本信息,包含时间信息、文档名、全部者以及所属组等,在文件系统建立时生成且个数有限,这三个time属性值存放在inode中==linux

相关文章
相关标签/搜索