Link to home
Start Free TrialLog in
Avatar of God
God

asked on

Can one determine whether a file has symbolic or hard links to it?

Is there any way with a shell command or in a perl script to determine if a file has a symbolic or hard link to it? The obvious solutions, using stat and checking the link count don't seem to work - files with links show count of 1, and directories show a count of 2.
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tagish
tagish

Hello,

I use ls -la at the command prompt. The results should be similar to the following:  permisions owner group size date_created folder/file name -> folder/file name This is a symbolic link. The first folder/file name is the "linked" directory, the second folder/file name is the "original" folder  or the one linked from.  I think if it is a hard link the -> will become ->> but I am not 100% certain of the hard link symobol.
 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of God

ASKER

darn.
Avatar of God

ASKER

How do you divy up points?
Used to be a "Split Points" link near the comment entrybox... Some have had luck with oldlook ... http://oldlook.experts-exchange.com/questions/20812105/Can-one-determine-whether-a-file-has-symbolic-or-hard-links-to-it.html#9850566

-- Glenn
You can probably file a request in the Community Support area if you want to split points.
Avatar of God

ASKER

I'm sorry - I meant to credit Khkremer - but I'd like to give a portion to Gns as he clarified some more.  Tagish, I appologize - I did not intend to accept your answer.  I appreciate your comment, but it doesn't deal with link count.  I will post the point correction in community support.