Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

a short question: is it possible to list all symbolic links onto a directory other than running a find over the whole filesystem?

Background: I have a directory containing a lot of different versions of a library and I'd like to do some cleanup work and delete the versions which weren't used in any projects.

Thanks, Mathias

share|improve this question
up vote 4 down vote accepted

Unfortunately no. All information about a symlink is stored within the symlink itself, therefore it's impossible to find without scanning the entire filesystem.

share|improve this answer
Alright, thanks for the answer! – Mathias Apr 14 '10 at 17:50

You could something like this:

find /suspected/symlink/locations -type l -exec ls -l {} \; | grep ' SimlinkTargetDirectory'

share|improve this answer
Thanks, that was the method i knew, I just wanted to know if there's a simpler solution. – Mathias Apr 14 '10 at 21:42

ls -F will list everything but will give you a visual indication of what type the files are. Is that useful?

share|improve this answer

Your Answer


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.