36
10
When I used the find command, I almost always need to search the local drives. But, I almost always have super large network shares mounted and these are included in the search. Is there an easy way to exclude those in the find command, grep and other similar commands? Example:
find / -name .vimrc
My edit was rejected to this, so just making it a comment. Basically the first example is wrong, because you need to add
-prune
to it or it will still traverse the undesired file systems. The second example I believe was meant to be-path
instead of-name
so it will ignore the path. FWIW... the last example does work, it stays on the "current filesystem" so doesn't traverse others. – rogerdpack – 2019-04-16T17:48:07.403does that work for grep too? – Flotsam N. Jetsam – 2011-01-05T15:36:26.057
1
I don't think grep has such an option. I usually used
– Doug Harris – 2011-01-05T15:43:11.150find
pipe togrep
as shown in this answer: http://superuser.com/questions/80033/command-line-wizardry-spaces-in-file-names-with-find-grep-xargs/80050#80050 . Lately, I've been usingack
(http://betterthangrep.com/) instead, butack
doesn't seem to have an option to search only local drives.