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

相關文章
相關標籤/搜索