我在Debian GNU/Linux6.0上使用Bash。可以获取文件创建日期/时间吗?不是修改日期/时间。ls -lh a.txt
和stat -c %y a.txt
都只给出了修改时间。
发布于 2013-10-24 22:42:53
ls -i file #output is for me 68551981
debugfs -R 'stat <68551981>' /dev/sda3 # /dev/sda3 is the disk on which the file exists
#results - crtime value
[root@loft9156 ~]# debugfs -R 'stat <68551981>' /dev/sda3
debugfs 1.41.12 (17-May-2010)
Inode: 68551981 Type: regular Mode: 0644 Flags: 0x80000
Generation: 769802755 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 38973440
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 76128
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
atime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013
mtime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
**crtime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013**
Size of extra inode fields: 28
EXTENTS:
(0-511): 352633728-352634239, (512-1023): 352634368-352634879, (1024-2047): 288392192-288393215, (2048-4095): 355803136-355805183, (4096-6143): 357941248-357943295, (6144
-9514): 357961728-357965098
发布于 2013-03-14 17:10:08
mikyra的回答是good.The事实,就像他说的那样。
[jason@rh5 test]$ stat test.txt
File: `test.txt'
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 588720 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ jason) Gid: ( 500/ jason)
Access: 2013-03-14 01:58:12.000000000 -0700
Modify: 2013-03-14 01:58:12.000000000 -0700
Change: 2013-03-14 01:58:12.000000000 -0700
如果要验证文件是首先创建的,可以在创建一系列文件时通过附加系统日期来构造文件名。
发布于 2013-03-14 12:36:28
请注意,如果出于性能原因使用noatime挂载了文件系统,那么atime可能会显示创建时间。鉴于noatime会带来巨大的性能提升(通过在每次读取文件时删除磁盘写操作),它可能是一个明智的配置选项,也可以提供您想要的结果。
https://stackoverflow.com/questions/14842195
复制相似问题