How to see information inside inode data structure

If you have a ext2/3/4 filesystem you can use debugfs for a low-level look at an inode. For example, to play without being root:

$ truncate -s 1M myfile
$ mkfs.ext2 -F myfile
$ debugfs -w myfile
debugfs:  stat <2>
    Inode: 2   Type: directory    Mode:  0755   Flags: 0x0
    Generation: 0    Version: 0x00000000
    User:     0   Group:     0   Size: 1024
    File ACL: 0    Directory ACL: 0
    Links: 3   Blockcount: 2
    Fragment:  Address: 0    Number: 0    Size: 0
    ctime: 0x5722081d -- Thu Apr 28 14:54:53 2016
    atime: 0x5722081d -- Thu Apr 28 14:54:53 2016
    mtime: 0x5722081d -- Thu Apr 28 14:54:53 2016
    BLOCKS:
    (0):24
    TOTAL: 1

The command stat takes a inode number inside <>.


You can find inode information using stat command.

# stat myfile.txt
  File: myfile.txt
  Size: 2023        Blocks: 8          IO Block: 4096   regular file
Device: fd03h/64771d    Inode: 15997895    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   antop)   Gid: ( 1000/   antop)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2019-08-30 08:29:16.974661276 +0530
Modify: 2019-08-30 08:29:16.974661276 +0530
Change: 2019-08-30 08:29:16.974661276 +0530
Birth: 2019-08-30 08:29:16.974661276 +0530

a detailed note on inode, hardlink & softlink