Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is literally nothing on google that I can find that will help me answer this question. I presume it is passing some other parameter to ls -i?

share|improve this question
up vote 13 down vote accepted

Yes, the argument -i will print the inode number of each file or directory the ls command is listing. As you want to print the inode number of a directory, I would suggest using the argument -d to only list directories. For printing the inode number the directory /path/to/dir, use the following command line:

ls -id /path/to/dir

From man ls:

   -d, --directory
          list  directory entries instead of contents, and do not derefer‐
          ence symbolic links
   -i, --inode
          print the index number of each file
share|improve this answer

This works also with stat:

stat -c '%i' $DIR

From man stat:

   -c  --format=FORMAT
          use the specified FORMAT instead of the default; output  a  new‐
          line after each use of FORMAT

   The valid format sequences for files:    
       %i     inode number
share|improve this answer
I'd like to add that the stat command from FreeBSD, NetBSD, OpenBSD and OS X works a bit differently and stat -f '%i' $DIR has to be used. – Cristian Ciupitu Jun 24 '14 at 23:02

You can find inode of file and directory with -i option

ls -id /home/user/dir

You can get information of consumed inode of your system

df -hi

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.