Listing hard and soft links to a file!
I have the following text after the url for explaining how we can list
hard and soft links to a file. If anyone can share his knowledge on
this subject, I will be happy to know about that. For more information
about hard and soft links you can see at the following url

http://linux-certification.blogspot....-symbolic.html



How can we list all of the hard links or soft links to a particular
file?

List Hard Links

You can list all of the hard links to a file 'file1' by using the
following command

[EMAIL PROTECTED] find [directory to search] -samefile [file name (which can
be any hard link) as argument]

for example

[EMAIL PROTECTED] find / -samefile file1

or

[EMAIL PROTECTED] find . -samefile file1

You can also use the inode number for searching the hard links to it

for example

[EMAIL PROTECTED] find . -inum [inode number]

You can find the inode number of a file by using the following command

[EMAIL PROTECTED] ls -i

List Soft Links

You can list the soft links to a file using the following command

[EMAIL PROTECTED] find -lname file1

It is better to put a * as prefix in the file name like below

[EMAIL PROTECTED] find -lname "*file1"

Because we have not mentioned the directory where the search should be
made so the search will be made in the current directory. We can
mention the directory where the search should be made in the following
way

[EMAIL PROTECTED] find . -lname "*file1"

or

[EMAIL PROTECTED] find / -lname "*file1"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
-~----------~----~----~----~------~----~------~--~---

Reply via email to