Solved

exclude NFS & EFS from find command searches.

Posted on 2013-02-01
9
929 Views
Last Modified: 2013-02-10
Am trying to overcome a stumbling block when using the find command. It may actually be simple but I'm not thinking clearly. If I use find -fstype nfs, it list NFS and/or EFS mount points. However, what I want to do is the  exclude NFS & EFS mount points when search starting at / (root) so I can get a faster search result. Does someone have a quick fix?
0
Comment
Question by:teckwiz01
  • 5
  • 4
9 Comments
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
-xdev
(some older versions use -local)
0
 

Author Comment

by:teckwiz01
Comment Utility
Can you give me an example of how to use that option? I've never used it before, didn't even know about it. I looked up man pages and some online stuff, but I'm still not clear on the syntax.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
find / -xdev -name funny-file
0
 

Author Comment

by:teckwiz01
Comment Utility
If there are multiple mount points, do can you just list them one after the other, do you need to use -xdev each time, or is it limited to just one mount point?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:teckwiz01
Comment Utility
Also, I'm getting this when I try a simple repeat of what you suggested.

# find / -xdev -name /nfs/sharedstuff
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name /nfs/sharedstuff' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ /nfs/sharedstuff'.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
hmm, I'm a bit confused according your example
  /nfs suggest to me that your searching nfs mounted file system, then -xdev does not make much sense

also -name expects a filename, not a pathname
0
 

Author Comment

by:teckwiz01
Comment Utility
Ok, I think I may have misunderstood the example given and used it the wrong way. I am definetly trying to exclude searching inside the nfs mount point. For example, lets say I want to search for apache on a bunch of machines. Apache has a default install location, but some install it in different placed for security reasons. So if I was searching for apache starting at root (/), having a remote mount point would cost me alot of time waiting for it to finish searching, so I want to exclude anything that is not part of the local system.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
Comment Utility
# repeating myself:
find / -xdev -name funny-file
0
 

Author Comment

by:teckwiz01
Comment Utility
OK ahoffmann. If you actually read my response, I said I misunderstood the example. I get it now. I thought you were saying to include the filesystem I'm trying to exclude. xdev doesn't decend into other filesystems. Sorry.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now