Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-02-2005, 07:37 AM   #1
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
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.
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 07:44 AM   #2
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
oh i forgot
need to show the symbolic link and the place it points to like so:
King -> mykingfolder
Lear -> mylearfolder

anyone?
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 08:19 AM   #3
maddox
Confirmed User
 
Join Date: Jan 2004
Location: Vienna, Austria
Posts: 648
try ls -al, otherwise if you want to list only symbolic links use find command
maddox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 08:32 AM   #4
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
ls -al | grep '^l'

?
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 11:17 AM   #5
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
I got this to list me the symbolic links:
find . -type -l
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 12:13 PM   #6
SplitInfinity
Confirmed User
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 3,047
Just type this in your directory that you are in:

ls -la|grep ^l
SplitInfinity is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 12:14 PM   #7
SplitInfinity
Confirmed User
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 3,047
Note that the ^l is ^ Ellllllll not pipe or eye or etc.
SplitInfinity is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 12:14 PM   #8
SplitInfinity
Confirmed User
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 3,047
Jesters-Computer:~ chris$ ls -la|grep ^l
lrwxr-xr-x 1 chris chris 5 2 Mar 11:05 temp -> /home
SplitInfinity is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 12:18 PM   #9
Workshop_Willy
Confirmed User
 
Join Date: Oct 2004
Location: Southern California
Posts: 452
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.
Workshop_Willy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-02-2005, 12:21 PM   #10
willow
Confirmed User
 
Join Date: Dec 2001
Location: NY, NY, USA
Posts: 131
find . -maxdepth 1 -type l

Thats 1 as in one, and the l as in Link. So I agree with Zester.

Last edited by willow; 03-02-2005 at 12:22 PM..
willow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.