[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't get "-mount" option to work

From: Ted Fines
Subject: Can't get "-mount" option to work
Date: Thu, 26 Sep 2013 09:48:30 -0500

I am using find 4.4.2 on Scientific Linux 6.4 (kernel
2.6.32-279.el6.x86_64).  I have been trying to get the syntax right for a
find command that returns a list of the directories on /, but only those
that are on the / filesystem.

Suppose on /, the directories are:
/home, /var, /opt, /bin, /boot, /dev, /tmp, /usr, /sys, /etc

If /home, /var  and /opt were on different filesystems the find command I
need would return only these:
/bin, /boot, /dev, /tmp, /usr, /sys, /etc

Please do not just suggest that I read the man pages or try '-mount' or
'-xdev'.  I've read and re-read these, tried different syntax, Googled,
etc.  I'm not getting it and just need some help.

FWIW, I have access to a Solaris 10 system, which has find though not GNU
find.  On that system, this syntax does exactly what I want:
          find / -mount \( -name '?*' -o -name '.*' \) -prune

But on the Linux system with GNU find the above command just returns "/".

Some ones I've tried:
For instance, these two commands return exactly the same results (all dirs):
find / -mount -maxdepth 1 -type d
find / -maxdepth 1 -type d

Since adding "-mount" is supposed to make find not descend  directories  on
other filesystems I wouldn't expect that.

Both of these return a single directory, '/':
find / -mount -maxdepth 1 -type d -prune
find / -maxdepth 1 -type d -prune

My other attempts return errors or nothing.

What I've found via Google
On http://tinyurl.com/myhsbx9 the cmds below are suggested.  Neither works.
find . -type d -print \( -name \* -prune \)
find / -type d -xdev

http://content.hccfl.edu/pollock/unix/findcmd.htm has some good examples
from what I can tell, but didn't help me out.

Gaa!  Ack! Help.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]