System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to list or find files that have soft links (ln)

 
SOLVED
Go to solution
Vinod Tandon
Occasional Advisor

Is there a way to list or find files that have soft links (ln)

Is there a way to find all files under a directory that have soft links (created using UNIX ln -s)?

I need find such files and create new links.

Thanks in advance
5 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: Is there a way to list or find files that have soft links (ln)

Hi Vinod:

# find /path -xdev -type l -exec ls -ld {} +

Regards!

...JRF...
Steven Schweda
Honored Contributor

Re: Is there a way to list or find files that have soft links (ln)

> Is there a way [...]

Exactly what you want is not clear to me. An
example might help.

Using "find [...] -type l [...]" is an easy
way to find find symbolic links. If you wish
to find all symbolic links which point to a
particular file, then you have a harder
problem.
John Guster
Trusted Contributor

Re: Is there a way to list or find files that have soft links (ln)

if you want know all the links under a directory, "ls -l|grep ^l" should do.
Dennis Handly
Acclaimed Contributor

Re: Is there a way to list or find files that have soft links (ln)

>I need find such files and create new links.
>find /path -xdev -type l -exec ls -ld {} +

You know the answer to your next question on how to crack the ll(1) output to create a bunch of "ln -s" commands?
Suraj K Sankari
Honored Contributor

Re: Is there a way to list or find files that have soft links (ln)

Hi,
>>Is there a way to list or find files that have soft links (ln)
Yes

#ls -lrt | grep ^l ( for current directiory)
you can use find for any perticular FS

#find /opt -type l -exec ls -lrt {} \;

Suraj