Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of finding the creation time of files in Linux

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the method of finding the creation time of files in Linux, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

The file creation time is stored in the inode of the ext4 file system. File creation time is not supported in previous versions of the ext file system. The debugfs stat output has a crtime (creation time) timestamp. Finally, ext4 supports creation time, just like btime in the ntfs window.

You can follow the instructions below to find the file creation time. For example, I am using a selected existing file or creating a new file for testing. For the files here.

Step 1: find the inode file number

First, use the following command on the terminal to find the inode number of any file.

$ls-I / var/log/secure13377/var/log/syslog

Step 2: find the file creation time (crtime)

After getting the inode number of the file, use the debugfs command with inode number statistics to follow the disk path.

$debugfs-R 'stat' / dev/sda1

Execution

$debugfs-R 'stat' / 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

Find the entry for crtime in the output above, which is the actual file creation time.

Thank you for reading this article carefully. I hope the editor will share the method and content of finding the creation time of the file in Linux. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report