可以按照以下说明查找文件创建时间。选个例子,我使用的是一个现择现有文件或创建新文件进行测试。对于这有的文件。
步骤1:查找inode文件编号
首先,在终端上使用以下命令查找任何文件的inode编号。
$ ls -i /var/log/secure13377/var/log/syslog
步骤2:查找文件创建时间(crtime)
获取文件的inode编号后,使用带有inode编号统计信息的debugfs命令跟随磁盘路径。
$ debugfs -r 'stat <inode_number>' /dev/sda1
执行
$ debugfs -r 'stat <13377>' /dev/sda1debugfs 1.41.12 (17-may-2010)inode: 13377 type: regular mode: 0600 flags: 0x80000generation: 2326794244 version: 0x00000000:00000001user: 0 group: 0 size: 223317file acl: 0 directory acl: 0links: 1 blockcount: 440fragment: address: 0 number: 0 size: 0 ctime: 0x5230b7ae:55efa068 -- thu sep 12 00:04:22 2013 atime: 0x5230b7ae:55efa068 -- thu sep 12 00:04:22 2013 mtime: 0x5230b7ae:55efa068 -- thu sep 12 00:04:22 2013crtime: 0x4eeacc8a:0948eb58 -- fri dec 16 10:13:54 2011size of extra inode fields: 28extended attributes stored in inode body: selinux = "system_u:object_r:var_log_t:s000" (31)extents:(0-24): 35008-35032, (25-54): 164224-164253
在上面的输出中找到crtime的条目,这是实际的文件创建时间。
本篇文章到这里就已经全部结束了,更多其他精彩内容大家可以关注的其他相关栏目教程!!!
以上就是如何在linux中查找文件创建时间(crtime)的详细内容。