Sometimes I need to find a file or directory on my local machine and I don’t want to scan large NFS file systems connected to my machine.
I am using following syntax for do so:
$ find / -path /net -prune -o -type d -name *gcc*
This command line will search for any directory on my local machine with name included “gcc”. It will not search below “/net”.
You can add any number of “-path … -prune -o” in front of “-type” to add more directories to exclude from search. For example:
$ find / -path /net -prune -o -path /proc -prune -o -type d -name *gcc*