Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

exclude NFS & EFS from find command searches.

Posted on 2013-02-01
9
Medium Priority
?
1,408 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 38845551
-xdev
(some older versions use -local)
0
 

Author Comment

by:teckwiz01
ID: 38847538
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
ID: 38848395
find / -xdev -name funny-file
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:teckwiz01
ID: 38861509
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
 

Author Comment

by:teckwiz01
ID: 38861551
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
ID: 38863350
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
ID: 38872491
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 400 total points
ID: 38872545
# repeating myself:
find / -xdev -name funny-file
0
 

Author Comment

by:teckwiz01
ID: 38873319
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

604 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