The time of the Linux file record

Source: Internet
Author: User

Production found a problem, find the root cause is because the file was modified, and then by looking at the modified time, the rights of the user, find the operation of the machine, which found a point is the Linux file time record, there are three access (access), Modfiy (vi Edit), change (Modify permissions)

Commonly viewed as stat filename and ls-l--full-time filename

1, when we just read the file, access time changes, and Modify,change does not change

2, Access,modify,change time will change when the file is modified

3, change time changes when file attributes are modified, and access,modify is unchanged

So with this in mind, touch can completely change the time you move files, and what you see is not real.

[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2126 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652821 links:1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
Access: 2016-08-28 18:08:26.571999874 +0800--accurate to millisecond level
Modify: 2016-08-28 18:08:26.571999874 +0800
Change: 2016-08-28 18:08:26.575999780 +0800
[Email protected] ~]#Cat 3.sql
-MySQL dump 10.13 distrib 5.5.22, for Linux (i686)
--
--host:192.168.4.11 Database:test
-- ------------------------------------------------------
--Server version 5.5.22-log
。。。。。。。。
[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2126 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652821 links:1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
Access: 2016-08-28 18:18:50.937999994 +0800--because just after the cat was executed, it changed only
Modify:2016-08-28 18:08:26.571999874 +0800
Change:2016-08-28 18:08:26.575999780 +0800

[Email protected] ~]#VI 3.sql
-MySQL dump 10.13 distrib 5.5.22, for Linux (i686)
--
--host:192.168.4.11 Database:test
-- ------------------------------------------------------
--Server version 5.5.22-log
。。。。。。。。 [Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2127 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652820 links:1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
Access: 2016-08-28 18:20:36.679998313 +0800---can see the VI is changed
Modify: 2016-08-28 18:20:36.679998313 +0800
Change: 2016-08-28 18:20:36.696998878 +0800
[Email protected] ~]#chmod o+w 3.sql
[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2127 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652820 links:1
Access: (0757/-rwxr-xrwx) Uid: (0/root) Gid: (0/root)
Access:2016-08-28 18:20:36.679998313 +0800
Modify:2016-08-28 18:20:36.679998313 +0800
Change: 2016-08-28 18:21:43.217999570 +0800
[Email protected] ~]#


[[email protected] ~]# Info Touch--This thing can not only create a file but also change the file time

Time stamps.

The program accepts the following options. Also See *note Common
Options::.

'-A '
'--time=atime '
'--time=access '
'--time=use '

Change the access time only .


[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2127 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652820 links:1
Access: (0757/-rwxr-xrwx) Uid: (0/root) Gid: (0/root)
Access:2016-08-28 18:24:23.473989642 +0800
Modify:2016-08-28 18:24:23.473989642 +0800
Change:2016-08-28 18:24:23.473989642 +0800
[Email protected] ~]#touch-a 3.sql---plus parameter-a
[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2127 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652820 links:1
Access: (0757/-rwxr-xrwx) Uid: (0/root) Gid: (0/root)
Access: 2016-08-28 18:24:34.580998824 +0800
Modify:2016-08-28 18:24:23.473989642 +0800
change:2016-08-28 18:24:34.580998824 +0800


[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2127 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652820 links:1
Access: (0757/-rwxr-xrwx) Uid: (0/root) Gid: (0/root)
Access:2016-08-28 18:24:34.580998824 +0800
Modify:2016-08-28 18:24:23.473989642 +0800
Change:2016-08-28 18:24:34.580998824 +0800
[Email protected] ~]#
[Email protected] ~]#Touch 3.sql--Wood with additional parameters
[Email protected] ~]# stat 3.sql
File: ' 3.sql '
size:2127 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:652820 links:1
Access: (0757/-rwxr-xrwx) Uid: (0/root) Gid: (0/root)
Access: 2016-08-28 18:28:26.230998361 +0800
Modify: 2016-08-28 18:28:26.230998361 +0800
Change: 2016-08-28 18:28:26.230998361 +0800
[Email protected] ~]#

This article from "Yun Weibang" blog, declined reprint!

The time of the Linux file record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.