Programmatically Retrieving the Inode For a File In Linux

ls uses the stat structure to provide this information via ls -i. Therefore, it should be available via any programming language whose stat implementation passes this information through:

$ ls -i .bashrc
18731977 .bashrc
$ python
>>> import os
>>> s = os.stat('.bashrc')
>>> s.st_ino
18731977