Linux xfs 文件系统查看文件创建时间 |
您所在的位置:网站首页 › 读取文件创建时间 › Linux xfs 文件系统查看文件创建时间 |
上一篇Linux xfs文件系统stat命令Birth字段为空的原因探究中,我们介绍了Linux xfs文件系统stat命令Birth字段为空的原因,这一篇,我们简单总结一下Linux系统下,xfs文件系统v5版本或之后版本中查看文件创建时间的两个方法,仅供参考。 注意:xfs文件系统v5之前的版本是没法查看文件创建时间的。这里讨论的是xfs v5版本以及后续版本。 1:stat命令查看[mysql@mysqlu03 ~]$ more /etc/redhat-release Red Hat Enterprise Linux release 8.7 (Ootpa)[mysql@yictmysqlu03 ~]$ touch test.txt[mysql@yictmysqlu03 ~]$ stat test.txt File: test.txt Size: 0 Blocks: 0 IO Block: 4096 regular empty fileDevice: fd05h/64773d Inode: 145 Links: 1Access: (0644/-rw-r--r--) Uid: ( 801/ mysql) Gid: ( 800/ mysql)Access: 2023-05-06 13:57:45.764277982 +0800Modify: 2023-05-06 13:57:45.764277982 +0800Change: 2023-05-06 13:57:45.764277982 +0800 Birth: 2023-05-06 13:57:45.764277982 +0800如果使用stat命令查看xfs文件的创建时间必须满足下面几个条件: xfs文件版本必须为v5或更高版本。操作系统内核版本必须等于或大于 4.11glibc版本必须等于或大于2.282:xfs_db查看如果Linux内核版本没有等于大于4.11或者glibc版本小于2.28的话,我们可以使用xfs_db命令查看文件的创建时间,具体命令如下所示: [root@kerrydb ~]# touch test.txt[root@kerrydb ~]# ls -i test.txt1457538 test.txt[root@kerrydb ~]# pwd/root[root@kerrydb ~]# df -T /rootFilesystem Type 1K-blocks Used Available Use% Mounted on/dev/mapper/vg00-root xfs 10475520 4005132 6470388 39% /[root@kerrydb ~]# xfs_db -r -c "inode 1457538" -c "p v3.crtime.sec" /dev/mapper/vg00-rootv3.crtime.sec = Wed May 10 17:19:22 2023[root@kerrydb ~]#如上所示,显示文件test.txt时2023-05-10 17:19:22创建的,时间完全正确。 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |