How to check when a file was created on a Linux system
This is a brief summary of https://unix.stackexchange.com/questions/50177:
- Find the device a file is located on:
df /path-to-file/filename.ext
-
Find inode number:
stat -c %i /path-to-file/filename.ext
- Get creation time by running:
debugfs -R 'stat ' DEVICE
[root@239elwb01 htdocs]# df w.php
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 575780228 453705732 116224912 80% /mnt/newdrive
[root@239elwb01 htdocs]# stat -c %i w.php
28364896
[root@239elwb01 htdocs]# debugfs -R 'stat <28364896>' /dev/sdb1
bash: debugfs: command not found
[root@239elwb01 htdocs]# /sbin/debugfs -R 'stat <28364896>' /dev/sdb1
debugfs 1.39 (29-May-2006)
Inode: 28364896 Type: regular Mode: 0644 Flags: 0x0 Generation: 3093107294
User: 501 Group: 48 Size: 9669
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 24
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5a5e1c67 -- Tue Jan 16 10:38:15 2018
atime: 0x5a5dbe07 -- Tue Jan 16 03:55:35 2018
mtime: 0x5a5dbeb1 -- Tue Jan 16 03:58:25 2018
BLOCKS:
(0-2):56732793-56732795
TOTAL: 3
Add new comment