stat:查看文件时间参数

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 \n 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.1100150020700   --> find  atime
Modify: 2015-06-08 20:34:49.5080188980700   --> find  mtime
Change: 2015-06-08 20:34:49.5080188980700   --> 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 \n in  FORMAT.
-t, --terse           print the information in  terse form
     --help     display this help and exit
     --version  output version information and exit

转载于:https://www.cnblogs.com/pacino12134/p/11481258.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值