Solved

exclude NFS & EFS from find command searches.

Posted on 2013-02-01
9
1,087 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

726 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