find: /dev/fd/3: Not a directory
Running this command sudo find / -iname *.app
, among the entries returned was:
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
Why is this and how can I fix it?
Solution 1:
sudo find -x / -iname *.app
or
sudo find / -iname *.app 2>/dev/null
The first solution prevents find
from descending into directories that have a device number different that that of the file from which the decent began. This prevents the errors from occurring, but limits the search to a single device.
The second solution does not stop the error messages from being generated. Instead, the message are just discarded so you do not see them. This solution discards not only the error messages you describe, but rather all error messages.
Solution 2:
The errors indicate the problem. It states that /dev/fd/3 and /dev/fd/4 are not directories, because they're not, even though they appear to be directories.
The files /dev/fd/_ through /dev/fd/# refer to file descriptors which can be accessed through the file system.
Source: https://developer.apple.com/library/prerelease/mac/documentation/Darwin/Reference/ManPages/man4/fd.4.html