cancel
Showing results for 
Search instead for 
Did you mean: 

Listing linked files

SOLVED
Go to solution
Ron Irving
Trusted Contributor

Listing linked files

Is there a way to list only linked files, in HP-UX ver 10.20? We're doing an application upgrade in the near future...just wondering.

Ron
Should have been an astronaut.
6 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Listing linked files

Hi Ron:

You can do a 'find' looking for 'type l', as:

# find /etc -type l

This will retrun symbolic linked files.

If you are looking for hardlinks (and here, the /sbin directory is a fine example), do this:

# cd /sbin
# ls -ilR | awk '$2 ~/l/ || ($2 !~/d/ && $3 > 1)' | sort -k1n | more

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Listing linked files

Hi:

I'll assume you are just interested in files rather than directories. For hard links:
find . -link +1 -type f

For symbolic links
find . -type l

Clay
If it ain't broke, I can fix that.
Ron Irving
Trusted Contributor

Re: Listing linked files

Clay, when I type 'find / -link +1 -type f', it comes back with bad option, -link. Any ideas?

ron
Should have been an astronaut.
James R. Ferguson
Acclaimed Contributor

Re: Listing linked files

Hi Ron:

Clay meant "links" [plural] as:

# find /sbin -links +1 -type f

...JRF...
Tracey
Trusted Contributor

Re: Listing linked files

When I do it, I usually just want for the current directory so I use an alias that I have set to:

ls -la | grep ^l

MANOJ SRIVASTAVA
Honored Contributor
Solution

Re: Listing linked files

Hi Ron

Try this

ls -laR | grep ^l > /tmp/test


Manoj Srivastava