Use the stat file I can check the file's recent modify time, and create time.

[root@controller network-scripts]# stat ifcfg-enp2s0f0
  大小:444        块:8          IO 块:4096   普通文件
device:fd00h/64768d Inode:1708165     硬链接:1
limit:(0644/-rw-r--r--)  Uid:(    0/    root)   Gid:(    0/    root)
recent access:2017-10-08 19:51:13.715800341 +0800
最近更改:2017-08-31 14:57:14.703346036 +0800
recent change:2017-08-31 14:57:14.745346036 +0800

Whether there is a method to list all the time that changed the file?


A normal file system does not store a change log.

How to monitor file system changes is answered here:

  • and the xxx/network-script/ifcfg-enp2s0f0 do not store the change log too? – 244boy Oct 17 '17 at 9:04

No filesystem that I know of stores every modification time. Most give you only what you have already presented: creation, last access, and last modification.

As an experiment, make a tiny partition, maybe 32M or so. Put your preferred filesystem on it, and mount this partition somewhere (I'll use /mnt for this example). Some of the available size will be taken up by filesystem data, but we can ignore that. Time is stored as a 32- or 64-bit number of seconds since some epoch; we'll assume 32 here.

32M is 33554432 bytes. 32 bits is 4 bytes, so you could store 8,388,608 timestamps on a completely empty partition. Run a loop:

for ((x=0; x < 8500000; x=x+1)); do
    touch /mnt/somefile

This will touch a file on the filesystem 8.5 million times (and probably take a while). Importantly, if your system is storing every timestamp, then at some point you'll get a message that the filesystem is full.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.