zoukankan      html  css  js  c++  java
  • 浅谈linux 文件的三个时间

    linux文件包含哪些文件时间戳

    1. ctime:指inode上一次变动的时间
    2. mtime:指文件内容上一次变动的时间
    3. atime:指文件上一次的打开时间

    如何查看文件状态?

    [root@localhost ~]# stat anaconda-ks.cfg 
      File: ‘anaconda-ks.cfg’
      Size: 1532      	Blocks: 8          IO Block: 4096   regular file
    Device: fd00h/64768d	Inode: 134315951   Links: 1
    Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2018-09-27 14:18:57.241101232 +0800
    Modify: 2018-09-25 16:23:27.666231700 +0800
    Change: 2018-09-27 14:44:18.081563127 +0800
     Birth: -
    [root@localhost ~]# 
    

    使用touch -t 修改文件时间

    [root@localhost ~]# date && stat anaconda-ks.bak && ls -l anaconda-ks.bak 
    Thu Sep 27 15:28:06 CST 2018
      File: ‘anaconda-ks.bak’
      Size: 1532      	Blocks: 8          IO Block: 4096   regular file
    Device: fd00h/64768d	Inode: 134905508   Links: 1
    Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2018-09-27 15:27:33.730985321 +0800
    Modify: 2018-09-27 15:27:33.731985298 +0800
    Change: 2018-09-27 15:27:33.731985298 +0800
     Birth: -
    -rw------- 1 root root 1532 Sep 27 15:27 anaconda-ks.bak
    [root@localhost ~]# touch -t 201701010100 anaconda-ks.bak 
    [root@localhost ~]# date && stat anaconda-ks.bak && ls -l anaconda-ks.bak 
    Thu Sep 27 15:28:40 CST 2018
      File: ‘anaconda-ks.bak’
      Size: 1532      	Blocks: 8          IO Block: 4096   regular file
    Device: fd00h/64768d	Inode: 134905508   Links: 1
    Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2017-01-01 01:00:00.000000000 +0800
    Modify: 2017-01-01 01:00:00.000000000 +0800
    Change: 2018-09-27 15:28:39.243458931 +0800
     Birth: -
    -rw------- 1 root root 1532 Jan  1  2017 anaconda-ks.bak
    [root@localhost ~]# 
    
  • 相关阅读:
    php记录代码执行时间
    TortoiseSVN教程级别指南
    有些 where 条件会导致索引无效
    mysql优化
    SQL优化方法
    mysql服务性能优化 my.cnf my.ini配置说明详解(16G内存)
    mysql慢查询设置
    javascript和php使用ajax通信传递JSON
    PHP导出大量数据到excel表格
    核心支付业务
  • 原文地址:https://www.cnblogs.com/sdhzdtwhm/p/9713067.html
Copyright © 2011-2022 走看看