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 ~]# 
    
  • 相关阅读:
    BUPT复试专题—最小距离查询(2013)
    BUPT复试专题—中序遍历序列(2013)
    BUPT复试专题—统计节点个数(2013)
    BUPT复试专题—日期(2013)
    BUPT复试专题—内存分配(2014-2)
    BUPT复试专题—图像识别(2014-2)
    Catch That Cow(BFS)
    Pet(hdu 4707 BFS)
    Knight Moves(BFS,走’日‘字)
    Lost Cows(BIT poj2182)
  • 原文地址:https://www.cnblogs.com/sdhzdtwhm/p/9713067.html
Copyright © 2011-2022 走看看