![]() |
another boring unix question
ok, you had it coming:
how do I list symbolic links and only (symbolic links) in a certain folder? can't find the paramater for it with the "ls" command. |
oh i forgot
need to show the symbolic link and the place it points to like so: King -> mykingfolder Lear -> mylearfolder anyone? |
try ls -al, otherwise if you want to list only symbolic links use find command
|
ls -al | grep '^l'
? |
I got this to list me the symbolic links:
find . -type -l |
Just type this in your directory that you are in:
ls -la|grep ^l |
Note that the ^l is ^ Ellllllll not pipe or eye or etc.
|
Jesters-Computer:~ chris$ ls -la|grep ^l
lrwxr-xr-x 1 chris chris 5 2 Mar 11:05 temp -> /home |
ls -l | grep \> | grep "lr"
this does a long listing and greps on ">" which indicates a link. As an added filter, you can pipe that output to another grep "lr" which are the first two characters of the permissions string on a symbolic link. This will insure that you have only symbolic links in the output. This will only work on the current directory, as piping 'find' to 'ls' doesn't work. To search subdirectories, try this series of commands: ------------------------------------------------- shellprompt$ ls -l|grep "drw"|awk '{print "ls -l "$9" | grep \\> | grep \"lr\""}' > linksearch shellprompt$ . linksearch ----------------------------------------------- You could put the above in an executable script and run it from anywhere. I'm sure there are even better ways to do this. find . -name "*" -l n will work so long as you know the exact number of links a given file has, and has the advantage of walking an entire hierarchy. I hope this helps. |
find . -maxdepth 1 -type l
Thats 1 as in one, and the l as in Link. So I agree with Zester. |
All times are GMT -7. The time now is 10:45 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123