Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mapping inode numbers to file names



On Apr 27, 2010, at 9:22 AM, Edward Ned Harvey wrote:
> 
> Is there any faster way to find the file name(s) when all you know is the
> inode number?  (Actually, all you know is all the info that's in the present
> directory, which is not limited to inode number; but, inode number is the
> only information that I personally know could be useful.)

Not the way that you seem to want.  inodes specifically do not contain any file naming references.  This is intentional.  It's how hard links on Unix work (and cross-linked files on FAT... er... don't).  What you need to do is traverse the raw directory data for the filesystem looking for the inode you want and matching it to one or more file names.  Yes, this will be slow.  No, there's no way around it.  You're stuck doing an exhaustive search if you want to go backwards.

--Rich P.








BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org