How can I work out the link count of an inode number? If I know the inode number is, say, 592255 - what workings out can I do to find out the link count?
I know directories have a link count of at least 2, but don't know how to work it out.
Finding the link count using the name
You can use the
Taking a look at the man page for
So you can get just this value directly using
Finding the link count using the inode
If on the other hand you know the inode number only you can work backwards like so:
Give the inode number to the
This number (1) is actually the link-count of the file, when referring to a file, or the number of contained directory entries, when referring to a directory (including the . and .. entries).
Also for example
This is inode number for /etc/passwd. Now you can find how many links is actualy linked with this number of inode 8654127 with:
In my example it is only /etc/passwd, so you can do for your case:
To get the link count from the inode without searching the full filesystem, on an