atime:Access time,在讀取文件或執行文件時更改。ide
mtime:Modifiedtime,在寫入文件時隨文件內容的更改而更改。spa
ctime:Change time,在寫入文件、更改全部者、權限或連接設置時隨inode的內容更改而更改。mtime改變,ctime隨之改變。orm
(1)只有讀取或者執行文件後,atime改變,而mtime,ctime不改變。視頻
(2)只想文件寫入內容後,mtime改變,ctime改變,而atime不改變。get
(3)只修改inode信息(除文件內容)後,ctime改變,而atime,mtime不改變。同步
[root@localhost tmp]# touch aaa
#mtime,修改內容時間/建立時間
-rw-r--r--. 1 root root 0 3月 12 21:13 aaa
[root@localhost tmp]# ls -l --time=atime aaa
#atime,讀取內容時間
-rw-r--r--. 1 root root 0 3月 12 21:13 aaa
[root@localhost tmp]# ls -l --time=ctime aaa
#ctime,修改屬性時間
-rw-r--r--. 1 root root 0 3月 12 21:13 aaa
[root@localhost tmp]# chmod 666 aaa
-rw-rw-rw-. 1 root root 5 3月 12 21:31 aaa
[root@localhost tmp]# ll --time=atime aaa
-rw-rw-rw-. 1 root root 5 3月 12 21:31 aaa
[root@localhost tmp]# ll --time=ctime aaa
-rw-rw-rw-. 1 root root 5 3月 12 21:33 aaa #ctime改變
-rw-rw-rw-. 1 root root 5 3月 12 21:31 aaa
[root@localhost tmp]# ll --time=ctime aaa
-rw-rw-rw-. 1 root root 5 3月 12 21:33 aaa
[root@localhost tmp]# ll --time=atime aaa
-rw-rw-rw-. 1 root root 5 3月 12 21:35 aaa #atime改變
-rw-rw-rw-. 1 root root 10 3月 12 21:36 aaa #mtime改變
[root@localhost tmp]# ll --time=ctime aaa
-rw-rw-rw-. 1 root root 10 3月 12 21:36 aaa #ctime改變
[root@localhost tmp]# ll --time=atime aaa
-rw-rw-rw-. 1 root root 10 3月 12 21:35 aaa
[root@localhost tmp]# touch aaa
-rw-r--r--. 1 root root 0 Mar 12 22:41 aaa
[root@localhost tmp]# ll --time=atime aaa
-rw-r--r--. 1 root root 0 Mar 12 22:41 aaa
[root@localhost tmp]# ll --time=ctime aaa
-rw-r--r--. 1 root root 0 Mar 12 22:41 aaa
[root@localhost tmp]# touch -a aaa
[root@localhost tmp]# stat aaa
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 7595 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-03-12 22:55:16.151176379 +0800
Modify: 2020-03-12 22:47:19.151147596 +0800
Change: 2020-03-12 22:55:16.151176379 +0800
[root@localhost tmp]# touch -m aaa
[root@localhost tmp]# stat aaa
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 7595 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-03-12 22:55:16.151176379 +0800
Modify: 2020-03-12 22:56:09.743179613 +0800
Change: 2020-03-12 22:56:09.743179613 +0800
[root@localhost tmp]# touch -c aaa #或者 touch aaa
[root@localhost tmp]# stat aaa
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 7595 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-03-12 22:57:14.750183535 +0800
Modify: 2020-03-12 22:57:14.750183535 +0800
Change: 2020-03-12 22:57:14.750183535 +0800
3.無論是修改atime,仍是修改mtime,ctime都會變。
[root@localhost tmp]# touch -m -d "2 days ago" aaa
[root@localhost tmp]# stat aaa
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 7595 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-03-12 22:57:14.750183535 +0800
Modify: 2020-03-10 23:10:32.056361925 +0800
Change: 2020-03-12 23:10:32.056231646 +0800
[root@localhost tmp]# touch -a -t 202005051010.10 aaa
[root@localhost tmp]# stat aaa
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 7595 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2020-05-05 10:10:10.000000000 +0800
Modify: 2020-03-10 23:10:32.056361925 +0800
Change: 2020-03-12 23:13:18.713241702 +0800
#注:1.atime被修改成2020-05-05 10:10:10。
2.ctime自動更新。