Atime, Mtime, CTime, called the timestamp of the file, is one of seven of the file's meta-information, which is included in the inode. which
Atime (Accesstime) refers to the time when the file was last accessed;
Mtime (Modifytime) refers to the time when the contents of the file have been modified, but does not include the modification of the permission, such as modifying the content with the Vim editor;
CTime (Changetime) refers to the time that the file's permissions, owner, group, and number of links are changed.
View the commands for each time individually:
Ls-lu filename View Atime
ls-l filename View Mtime
LS-LC filename View CTime
To view commands at various times at the same time:
Stat filename
Here's an example to see how three times change, first create a file:
echo "123456" >/tmp/1.txt
View three time after creation:
Stat 1.txt
1. First use the Vim editor to view and exit, do not change the content Vim 1.txt:q! Force exit after viewing time,! [] (http://i2.51cto.com/images/blog/201805/24/35b0c81ae2009e7c7950fcefe95589e5.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) After comparison, it is found that atime changes, Mtime, CTime unchanged 2. Use the Cat command to view the contents of a file cat 1.txt then view three time! [] (http://i2.51cto.com/images/blog/201805/24/8fc73f92781b10eb488bdcb82f6ef50a.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) After comparison, the Atime, Mtime and CTime were not changed. 3. Use the Vim editor to make changes to the contents of the file Vim 1.txt Type I edit type one line of "456789",![ ] (Http://i2.51cto.com/images/blog/201805/24/ca05fff0498b88e60fc21be84740eec2.png?x-oss-process=image/watermark , size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=): Wq save exit, and then After viewing three time,! [] (http://i2.51cto.com/images/blog/201805/24/ec7da001fa15ba95f2c26d9f501eb1f6.png?x-oss-process=image/watermark,size_ 16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) Comparison found: Mtime and CTime changes 4. The file content has changed, use the command cat file again, and then see if there are any changes! [] (http://i2.51cto.com/images/blog/201805/24/c5a2657a9d32ebc2eabd83a37809f35a.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) After comparison, it was found that Atime changed 5. View time changes after changing permissions chmod u+x 1.txt view time situation,! [] (http://i2.51cto.com/images/blog/201805/24/3134afecbf2e91382d5cd8af6b81785d.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) Comparison found: CTime changed 6. When appending content to a file, three time changes echo "1234567890" >>/tmp1.txt! [] (http://i2.51cto.com/images/blog/201805/24/2287abbac254d6b6bec49aec08c2c8af.png?x-oss-process=image/ Watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) comparison found: Mtime, CTime change
Beginners Learn Linux: Atime, Mtime, CTime