How to get file creation date/time in Bash/Debian?

后端 未结 12 1780
有刺的猬
有刺的猬 2020-11-28 23:00

I\'m using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time. ls -lh a.txt and stat -c %y a.

12条回答
  •  忘掉有多难
    2020-11-28 23:47

    ls -i menus.xml

    94490 menus.xml Here the number 94490 represents inode

    Then do a:

    df -h

    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg-root   4.0G  3.4G  408M  90% /
    tmpfs                 1.9G     0  1.9G   0% /dev/shm
    /dev/sda1             124M   27M   92M  23% /boot
    /dev/mapper/vg-var    7.9G  1.1G  6.5G  15% /var
    

    To find the mounting point of the root "/" filesystem, because the file menus.xml is on '/' that is '/dev/mapper/vg-root'

    debugfs -R 'stat <94490>' /dev/mapper/vg-root

    The output may be like the one below:

    debugfs -R 'stat <94490>' /dev/mapper/vg-root

    debugfs 1.41.12 (17-May-2010)
    Inode: 94490   Type: regular    Mode:  0644   Flags: 0x0
    Generation: 2826123170    Version: 0x00000000
    User:     0   Group:     0   Size: 4441
    File ACL: 0    Directory ACL: 0
    Links: 1   Blockcount: 16
    Fragment:  Address: 0    Number: 0    Size: 0
    ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
    atime: 0x5266e47b -- Wed Oct 23 09:47:55 2013
    mtime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
    Size of extra inode fields: 4
    Extended attributes stored in inode body: 
      selinux = "unconfined_u:object_r:usr_t:s0\000" (31)
    BLOCKS:
    (0-1):375818-375819
    TOTAL: 2
    

    Where you can see the creation time:

    ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
    

提交回复
热议问题