LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-24-2009, 11:48 AM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Rep: Reputation: 46
How to search for a link to a certain path?


Hi guys. I have a /data and /backup. on backup there is a folder called Info that has a bunch of data on it, but its not shared through Samba. So what I'm thinking is that on one of my Samba shares on data there is a folder which is really just a link to that /backup/Info folder. Is there an easy way to search through /data to see if there's a link to it, or do i have to manually go through and do a ton of ls's?
 
Old 09-24-2009, 12:04 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
The "find" command might be just what you're looking for.

Google for "linux find command examples", or try "man find".

'Hope that helps .. PSM
 
Old 09-24-2009, 12:14 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
I read the man page for find, but I'm still confused. if i use lname will that search for my search term in the name of where the link points to?
 
Old 09-24-2009, 12:35 PM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
find is a notoriously difficult command to master and its man page is not an easy introduction (although it is an impeccably correct reference). As a result there are lots of web pages about using find but I have not yet found one which explains how find works. Mostly they just give HOWTO examples of common tasks which is fine until you want to do something different and need to master find to use its immense power and flexibility.

You mentioned samba but that's for mounting Linux file systems on Windows in which case symlinks are meaningless on the Windows system. Do we need to know about your samba setup to understand the problem or is the problem within a Linux environment and just happens to be about a file system which is shared by samba?
 
Old 09-24-2009, 12:38 PM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
My problem is that nobody can tell me anything about that Info folder I have. So I was taking a guess and thinking that maybe there was a folder on one of my Samaba shares on /data which people dropped files into, but it was really a link putting the files in /backup/Info instead, maybe to save space on /data.

If I do a ls in every single directory under /data that is shared out through samba I could see this probably, but that would take me hours of manual work.
 
Old 09-24-2009, 12:57 PM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Do you mean that /data is shared via Samba and that client systems (probably Windows) users are putting files in a directory on the share which directory is actually a symlink to /backup/Info so the files end up in /backup/Info?

So what you want to do is find symlinks on /data that point to /backup/Info? If that is correct then Samba is irrelevant to the question. Or have I not understood yet?
 
Old 09-24-2009, 01:00 PM   #7
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
You have it right. I want to find symlinks on /data that point to /backup/Info. Samba isn't part of the problem, was just giving some background so you understood the situation/setup.
 
Old 09-24-2009, 01:14 PM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
This might work
Code:
find /data -lname '*/backup/Info'
but not if the symlink goes via other symlinks to eventually point at /backup/Info.

If you dont have too many symlinks on /data then how about finding them all with
Code:
find /data -lname '*'
Alternatively you could configure Samba not to action symlinks.
 
Old 09-24-2009, 01:34 PM   #9
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
ok, thanks, it didn't find anything so there must not be any.
 
Old 09-24-2009, 01:38 PM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
What were the original problem symptoms that made you suspect there might be some synlink(s) on /data, pointing to /backup/Intro?
 
Old 09-24-2009, 01:45 PM   #11
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
The files have the same owner and group as those on some of the samba shares on data. it was either that or someone did a copy of hte files from the server as that user, but nobody here knows.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you make search ...search a string in a link....a url...a web address aus9 LQ Suggestions & Feedback 4 04-16-2008 10:37 AM
search path ($PATH) weird issue bricedebrignaisplage Linux - General 3 04-25-2007 05:41 AM
standard search path of g++ ekdya Programming 2 07-22-2006 02:40 PM
adding to search path sefzik Linux - Software 2 01-28-2005 03:26 PM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 07:10 PM


All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration