文件數據分成兩類
- 元數據,英文叫metadata,是數據的屬性;
- 數據,英文叫data,是數據本身;
使用stat命令查看元數據信息
[0][root@localhost mylinux]# stat /etc/passwd
File: ‘/etc/passwd’
Size: 889 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 67491848 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:passwd_file_t:s0
Access: 2018-02-28 22:01:01.151309330 -0500
Modify: 2018-02-26 21:47:50.978115380 -0500
Change: 2018-02-26 21:47:50.980115380 -0500
Birth: -
其中各屬性的含義:
- file:文件名
- size:文件大小
- block:文件占了多少個數據塊
- IO Block:文件所占數據塊的塊大小
- Device:硬件,既說明該文件在硬盤的那個柱面
- Inode:節點號
- links:鏈接
- Access(第一個):權限
- Uid:該文件所屬的屬主
- Gid:該文件所屬的屬組
- context:安全上下文
- Access:文件最近一次的訪問時間
- Modify:文件最近一次數據的修改時間
- Change:文件最近一次屬性的更改時間
- Birth:文件創建時間
使用touch命令修改文件的時間戳信息:
語法: touch [option]… file…
選項:
- -c: 指定的文件路徑不存在時不予創建
- -a:僅修改access time
- -m:僅修改modify time
- -t STAMP:使用指定的日期時間
實例:把myliunx目錄的modify time修改成2012年1月3日3時3分3秒
[0][root@localhost tmp]# stat mylinux
File: ‘mylinux’
Size: 143 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 67160137 Links: 14
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2018-02-28 21:34:32.912693874 -0500
Modify: 2018-02-28 21:34:01.908727303 -0500
Change: 2018-02-28 21:34:01.908727303 -0500
Birth: -
[0][root@localhost tmp]# touch -m -t 0212010303.03 /tmp/mylinux/
[0][root@localhost tmp]# stat mylinux
File: ‘mylinux’
Size: 143 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 67160137 Links: 14
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2018-02-28 21:34:32.912693874 -0500
Modify: 2002-12-01 03:03:03.000000000 -0500
Change: 2018-02-28 23:08:16.678646707 -0500
Birth: -
本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.www58058.com/91795
沒問題。