≡ Menu

Linux / Unix: Find Inode Of a File Command

How do I find out an inode (index-node) of a file under Unix like operating systems?

An inode number stores all the information about a regular file, directory, or other file system object, except its data and name. To find an inode, either use the ls or stat 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
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 5 comments… add one }
  • Fazhrie May 30, 2012, 3:39 pm

    Everything has its pros and cons.Unix came first. Linux was born from it. UNIX: used for really big sytmess. more stable. good for doing standard things or old internet things.LINUX: more toys. tends to be prettier. popular for personal servers and desktop machines. good for doing newly thought of things on the netThink of Unix as a semi-truck and Linux as a hot car. Both can be used to haul freight or drive around town but the best choice for each is pretty obvious.

  • SAlder August 1, 2012, 4:00 pm

    ‘ls -i ‘ number to the far left is the inode.

  • marty March 3, 2013, 6:26 am

    The only time I’ve even needed to know the inode number is if I have a file with some very strange name that prevents me from (easily) using “rm”.

    I get into the parent directory then use (from memory, I haven’t actually had my hands on a unix box in a while) find . -exec ls -i {} \;

    That could be grossly wrong somehow, but I’m sure someone will jump in.

    I can then use “rm” to remove the inode number and not need the file name. Seems to me that I might have had to use that find/exec thing again.

  • Srini October 23, 2014, 10:48 am

    df -i

    This will display fs, inode, iused, ifree, iuse%, mount on….

    • Nagaraju May 26, 2015, 2:20 am

      Hi srini,



Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , , , ,