####描述文件的元数据信息有哪些,分别表示什么含义,如何查看?如何修改文件的时间戳信息?

1,元数据信息:

File:文件名
Size:文件大小(单位:B)
Blocks:文件所占块个数
IO Block:每个数据块的大小(单位:B)
regular file:普通文件(此处显示文件的类型)
Inode:文件的Inode号,文件的索引节点号
Links:硬链接次数
Access:权限
Uid:(属主id/属主名)
Gid:(属组id/属组名)
Context:文件所在的环境
Access:最近访问时间access time (atime)
Modify:数据改动时间modification time (mtime)
Change:元数据改动时间status time (ctime)
Creat:文件创建时间

1.1,使用stat filename 进行查看

  File: anaconda-ks.cfg
  Size: 1571      	Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d	Inode: 67569417    Links: 1
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:admin_home_t:s0
Access: 2021-01-24 14:48:06.890381134 +0800
Modify: 2020-06-04 13:22:29.079686821 +0800
Change: 2020-06-04 13:22:29.079686821 +0800
 Birth: -

1.2,修改文件的时间戳信息

1.2.1,修改文件访问时间

[root@192 ~]# touch -cat 202101010011.01 a.txt 
[root@192 ~]# stat a.txt 
  File: a.txt
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d	Inode: 67150720    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:admin_home_t:s0
Access: 2021-01-01 00:11:01.000000000 +0800
Modify: 2021-01-01 00:00:01.000000000 +0800
Change: 2021-02-07 23:51:27.991832724 +0800
 Birth: -

1.2.2,修改文件数据改变时间

[root@192 ~]# touch -mt 202101010019.01 a.txt 
[root@192 ~]# stat a.txt 
  File: a.txt
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d	Inode: 67150720    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:admin_home_t:s0
Access: 2021-01-01 00:11:01.000000000 +0800
Modify: 2021-01-01 00:19:01.000000000 +0800
Change: 2021-02-07 23:54:47.265944146 +0800
 Birth: -

常用选项

-a, --time=atime, --time=access, --time=use
只修改存取时间.
-c, --no-create
如果要修改的文件不存在,此选项使touch不去创建它.
-d, --date=time
使用时间值 time 代替指定文件的戳记值.可以包含月份
名,时区名以及am'和 pm'等等.【会同时修改Atime和Mtime,自己指定时间】
-f 此选项用于兼容BSD版本的 touch(1).
-m, --time=mtime, --time=modify
只修改修改时间.
-t time
使用指定的时间值 time 作为指定文件 file

posted @ 2021-02-07 23:59  recvfrom  阅读(136)  评论(0)    收藏  举报