0

I would like to get the created time form any file/folder
The method i got the information on other Linux distribution (RHEL)
works in this form:

sudo debugfs -R 'stat <iNodeNr>' /xxxxx

where "xxxxx" means the partition on the target file/folder exists

stefansson
  • 141
  • 3

2 Answers2

1

Very similar to what was used in the link you posted you can do this from the commandline:

sudo debugfs -R "stat /home/pi/.bashrc" /dev/mmcblk0p2 | grep crtime

the only changes are:

  • the use of sudo to run the command as root,
  • the use of an absolute file path rather than an inode (though an inode would have worked),
  • and the partition to scan, as the Pi does not have a normal hard drive and hence no /dev/sda.
Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
0

The way @Steve Robillard helped me with the full path between double quotes

sudo debugfs -R "stat /home/username/....file" /dev/mmcblk0p2 | grep crtime

I gave a try with iNodes too

ls -i    
#lists the iNode number befor the files/folders
#where **401303** is an iNode of one of my files

this too following commands also worked for me:

sudo debugfs -R "stat <401303>" /dev/mmcblk0p2 | grep crtime
sudo debugfs -R 'stat <"'401303'">' /dev/mmcblk0p2 | grep crtime

Important is the quotation. The simple quote could cose difficulties. In case you are writing a script on different shell systems it might be useful to know both of them.

And the path from the end of commands you can find by this command where the last row is important

sudo fdisk -l | grep "mmcb\|Linux"
#results the followin rows:
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
/dev/mmcblk0p1        8192   137215   129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      137216 30253055 30115840 14.4G 83 Linux

sudo fdisk -l | grep "Linux" | cut -d ' ' -f1

results: /dev/mmcblk0p2

Thanks Steve

stefansson
  • 141
  • 3