天天看點

linux修改檔案的時間屬性

touch 用法:

    1. 同時修改檔案的修改時間和通路時間

touch -d "2010-05-31 08:10:30" test.doc

2. 隻修改檔案的修改時間

touch -m -d "2010-05-31 08:10:30" test.doc

3. 隻修改檔案的通路時間

touch -a -d "2010-05-31 08:10:30" test.doc

stat 指令

終端下運作指令:

# stat 檔案名   

Access後面的時間就是通路時間

會顯示檔案時間資訊例如:

#stat test  

File: "test'"

  Size: 307             Blocks: 8          IO Block: 4096   普通檔案

Device: 807h/2055d      Inode: 590978      Links: 1

Access: (0755/-rwxr-xr-x)  Uid: ( 1000/ tester)   Gid: (  100/   users)

Access: 2011-04-08 15:53:22.000000000 +0800

Modify: 2010-07-23 15:02:23.000000000 +0800

Change: 2011-02-17 17:01:15.000000000 +0800

繼續閱讀