Solved

exclude NFS & EFS from find command searches.

Posted on 2013-02-01
9
974 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
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
 

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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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 100 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

24 Experts available now in Live!

Get 1:1 Help Now