LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Listing Files that shares the same link (https://www.linuxquestions.org/questions/linux-newbie-8/listing-files-that-shares-the-same-link-97929/)

FireAllianceNX 09-28-2003 03:15 PM

Listing Files that shares the same link
 
I need help with listing a file and its link (symbolic).
I tried
Code:

ls -HUl filename
but I'm not sure...

Is there anyway that this can be done?

Thanks in advance for any help! :)

:newbie:

-Leon

david_ross 09-28-2003 03:49 PM

Welcome to LQ.

Do you mean that you jsut want to see where the link goes? Just use:
ls -l /path/to/symlink

FireAllianceNX 09-28-2003 03:51 PM

Nah... say I know file1 has a link

How do I list the names/path of all the links that links to file1 ???

-Leon

david_ross 09-28-2003 04:44 PM

Ah - see what you mean. You cna use find:
find -lname file1

EDIT: To search your entire drive not just from the dir you are in:
find / -lname file1

FireAllianceNX 09-28-2003 05:01 PM

Hm... that didn't work :(

Is there a way I can just grep the i-node numbers and just say they're the same so they're linked together...? lol *sigh*

I created a file with 4 links to test it out...
same inode numbers

when I executed the find command, it returned nothing.. does that only works with Hard links??

:'(

david_ross 09-28-2003 05:12 PM

It worked fine for my symlinks. What command did you issue? Did you see my edit about seaching the entire system?

FireAllianceNX 09-28-2003 05:36 PM

all my linked files are in my ~/
I made 4... ln file1 file2
cp -l file1 file3
and ln for the rest
then I used find ~/ -lname file1
all I get back was $(...blankingcursorgoeshere...)

FireAllianceNX 09-28-2003 07:08 PM

Looks like I made a boo boo, it's a hard link... lol Sorry :(

So back to square one *sigh*


All times are GMT -5. The time now is 01:23 PM.