Linux file time

1 Concept

There are three types of file times in Linux

  1. access time. atime, is the last time the document was read. Commands such as cat, more, less, grep, sed, tail, and head will modify the access time of the file.
  2. modify time. mtime, is the time when the document content was modified. Editing a document with vim will modify the modify time. Note that atime and mtime are different, atime is the time when the file was just opened, mtime is the time to exit after saving the file content
  3. change time. ctime, is the time when the document inode changed, such as location, attribute, etc. Actions such as chmod, chown, create, and mv will modify the change time of the Linux file to the current system time.

Note: ctime is an abbreviation for change time, not for create time. Linux has no file creation time

2 View commands

2.1 Use stat to view the atime, mtime, and ctime of the file, as follows
stat

2.2 ls command

  • ls -l View the modify time of the file
  • ls -lu View the access time of the file
  • ls -lc to view the change time of the file

refer to

  1. http://blog.51cto.com/linuxgp/477041
  2. https://blog.csdn.net/zyz511919766/article/details/14452027

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324923952&siteId=291194637
Recommended