Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to find every symbolic link on the server.

The version is AIX 6.1.

man find says

-L Follow symbolic links

But find -L is not a proper usage. Usage: find [-H | -L] Path-list [Expression-list]

I tried to Google this but couldn't find answers.

share|improve this question

migrated from stackoverflow.com Jan 13 '12 at 15:51

This question came from our site for professional and enthusiast programmers.

1  
By default, if you use find /some/directory -name '*.txt', the find command will not follow any symbolic links it finds as it is traversing the sub-structure of the starting directory. If you add the -L option, it will follow symbolic links (and, in particular, if any of those links leads to a directory, it will traverse that remote directory). The reason why this is not the default behaviour is that it can lead to 'infinite' paths. Consider what happens when you have a symlink created by ln -s . xyz...without the -L, there'll be no problem; with it, find runs for a long time. –  Jonathan Leffler Jan 13 '12 at 7:09

2 Answers 2

up vote 9 down vote accepted

You need to pass a top directory name. Some versions of find assume the current directory if you omit it, but not AIX's. Also, -L isn't what you want here: it tells find to follow symbolic links, but that's not what you're asking, you're asking to find symbolic links.

find / -type l -print will print out all the symbolic links.

See man find

share|improve this answer

If you want to know what the symbolic link points to, enter following command:

find / -type l -exec ls -l {} \;

share|improve this answer
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. –  Anthon Oct 1 at 9:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.