Monday 22 July 2013

Linux / Unix: Find Inode Of a File Command

ls Command: Display Inode


$ ls -li filename
$ ls -li /etc/resolv.conf

Sample outputs:
25766494 -rwxr-xr-x 1 root root 332 May 5 14:14 /etc/resolv.conf
25766494 is inode number and the -i option displays the index number (inode) of /etc/resolv.conf file.

stat Command: Display Inode


You can also use the stat command as follows:
$ stat fileName-Here
$ stat /etc/passwd

Sample outputs:
  File: `/etc/passwd'
Size: 1644 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 25766495 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-05-05 16:29:42.000000000 +0530
Modify: 2012-05-05 16:29:20.000000000 +0530
Change: 2012-05-05 16:29:21.000000000 +0530

No comments:

Post a Comment