Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How can I find all of the symbolic links on a unix/linux system?

share|improve this question
    
Note: don't exploit this to go round replacing the symlinks with copies of the linked files ... –  pjc50 Oct 14 '09 at 13:57

3 Answers 3

up vote 17 down vote accepted

Use with some caution. It will take a while.

find / -type l
share|improve this answer
# find / -type l
share|improve this answer

Unless you know the environment, never run "find /", run e.g. "find / /var /home -xdev". Parse the mount or df output for the list of filesystems. Otherwise NFS mounts could make your find take a VERY long time. In a reasonable environment, days or weeks is very possible.

I've seen more than one reasonable system on which a "find /" could not be expected to complete.

Beware of "-fstype nfs -prune". In addition to requiring an ugly (complicated and error-prone) find command, you'll end up with surprises from things like cifs.

share|improve this answer

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.