Linux 系统中,每个文件主要拥有 3 个时间参数,分别是文件的访问时间、数据修改时间以及状态修改时间:
- 访问时间(Access Time,简称 atime):只要文件的内容被读取,访问时间就会更新。例如,使用 cat 命令可以查看文件的内容,此时文件的访问时间就会发生改变。
- 数据修改时间(Modify Time,简称 mtime):当文件的内容数据发生改变,此文件的数据修改时间就会跟着相应改变。
- 状态修改时间(Change Time,简称 ctime):当文件的状态发生变化,就会相应改变这个时间。比如说,如果文件的权限或者属性发生改变,此时间就会相应改变。
Usage: stat [OPTION]... FILE... Display file or file system status. -L, --dereference follow links -Z, --context print the SELinux security context -f, --file-system display file system status instead of file status -c --format=FORMAT use the specified FORMAT instead of the default; output a newline after each use of FORMAT --printf=FORMAT like --format, but interpret backslash escapes, and do not output a mandatory trailing newline. If you want a newline, include in FORMAT. -t, --terse print the information in terse form --help display this help and exit --version output version information and exit
stat /etc/hosts Access: 2018-06-30 22:04:51.110015002 –0700 --> find atime Modify: 2015-06-08 20:34:49.508018898 –0700 --> find mtime Change: 2015-06-08 20:34:49.508018898 –0700 --> find ctime
Usage: stat [OPTION]... FILE...
Display
file
or
file
system status.
-L, --dereference follow links
-Z, --context print the SELinux security context
-f, --
file
-system display
file
system status instead of
file
status
-c --
format
=FORMAT use the specified FORMAT instead of the default;
output a newline after each use of FORMAT
--
printf
=FORMAT like --
format
, but interpret backslash escapes,
and
do
not output a mandatory trailing newline.
If you want a newline, include
in
FORMAT.
-t, --terse print the information
in
terse form
--help display this help and
exit
--version output version information and
exit