linux文件包含哪些文件时间戳
- ctime:指inode上一次变动的时间
- mtime:指文件内容上一次变动的时间
- 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 ~]#