View file inode directory inode information using stat command



Configuration for GNU Linux Fedora Computer using Linux Command

 

     The file or directory contains many information about the file or directory itself, but how to view these file information and directory information???  The Linux stat command can be use to view the file information including their inode number... The step by step command example below show the use of stat command to view file inode information and directory inode information in Linux Fedora system.

View inode information for file.

 

1.  The stat command below show the inode information for passwd file located under /etc directory

View file inode information using stat command on Linux Fedora system

[root@fedora ~]# stat /etc/passwd

  File: `/etc/passwd'

  Size: 2911           Blocks: 8 IO     Block: 4096 regular file

Device: fd00h/64768d    Inode: 324438   Links: 1

Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)

Access: 2008-08-11 05:24:17.000000000 -0400

Modify: 2008-08-03 05:11:05.000000000 -0400

Change: 2008-08-03 05:11:05.000000000 -0400

[root@fedora ~]#

 

View directory inode information.

 

1.  The stat command example below show the root home directory inode information located under / (root directory).

View directory inode information using stat command on Linux Fedora system

[root@fedora ~]# stat /root

  File: `/root'

  Size: 4096           Blocks: 8 IO     Block: 4096 directory

Device: fd00h/64768d    Inode: 343393   Links: 30

Access: (0750/drwxr-x---) Uid: ( 0/ root) Gid: ( 0/ root)

Access: 2008-08-11 05:36:00.000000000 -0400

Modify: 2008-08-11 05:33:07.000000000 -0400

Change: 2008-08-11 05:33:07.000000000 -0400

[root@fedora ~]#

 

The inode information contains:

  • Inode number
  • Mode information to discern file type and also for the stat C function
  • Number of links to the file
  • UID of the owner
  • Group ID (GID) of the owner
  • Size of the file
  • Actual number of blocks that the file uses
  • Time last modified
  • Time last accessed
  • Time last changed

 




1 comments:

Javin @ unix productivity tutorial said...

extremely useful does modify , access and change timestamp really show what they mean ?

Javin
10 example of using find command in Unix