Monica Heddneck
Monica Heddneck

Reputation: 3115

Why does 'find' on the terminal tell me it found files that don't exist?

I was poking around, looking for a file on the terminal (I'm using OS):

monica$ sudo find / -type f -name '*neo4j-desktop*'

Fine, right? So here's what I get back:

/Applications/Neo4j Community Edition 3.1.3.app/Contents/Resources/app/bin/neo4j-desktop-3.1.3.jar
/Applications/Neo4j Community Edition 3.1.3.app/Contents/Resources/app/lib/neo4j-desktop-3.1.3.jar
find: /dev/fd/Applications: No such file or directory
find: /dev/fd/Applications: No such file or directory

This has popped up for me on occasion. Why does find want to tell me it couldn't find a file twice? This makes no rational sense.

Upvotes: 1

Views: 95

Answers (1)

sjsam
sjsam

Reputation: 21955

You should be using -path -prune combination in this case

find -H / -type f -path "/dev*" -or -path "/proc*" -or -path "/sys*" -prune -o -name "*neo4j-desktop*" -print

Or do it like below

find -H  / -mount -type f -name "*neo4j-desktop*"

The [ find manpage ] says :

-mount
Don't descend directories on other filesystems. An alternate name for -xdev, for compatibility with some other versions of find.

Upvotes: 2

Related Questions