hard link identification

dteske at freebsd.org dteske at freebsd.org
Tue May 22 20:48:42 UTC 2012

> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org [mailto:owner-freebsd-
> questions at freebsd.org] On Behalf Of Gary Aitken
> Sent: Tuesday, May 22, 2012 1:06 PM
> To: freebsd-questions at freebsd.org
> Subject: hard link identification
> Is there any way to tell if something is a hard link, other than
>    ls -i
> of relevant files and seeing that the inode is the same?
> or a better way?
> I was a bit confused when looking at /root/.cshrc and then discovering a
> .cshrc in / as well.

ls -l

quickly enumerates the link-count of items in the current working directory
(displayed as the second column, by-default).

For directories, the link-count is quite obviously the number of filesystem
entities contained within.

For files, the link-count is the number of links to the same file. If this
number is higher than 1, then the file you're looking at is a hard-link (which
is also indistinguishable from the original).

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

More information about the freebsd-questions mailing list