When I use $ find / -name mywork-process, it will display the No such file or directory and Permission denied, there are too many items, I can not distinguish.

find: /System/Volumes/Data/.Spotlight-V100: No such file or directory
find: /System/Volumes/Data/.PKInstallSandboxManager: No such file or directory
find: /System/Volumes/Data/boot: No such file or directory
find: /System/Volumes/Data/.PKInstallSandboxManager-SystemSoftware: No such file or directory
find: /System/Volumes/Data/Library/Application Support/Apple/Screen Sharing/Keys: Permission denied
find: /System/Volumes/Data/Library/Application Support/Apple/ParentalControls/Users: Permission denied
find: /System/Volumes/Data/Library/Application Support/Apple/AssetCache/Data: Permission denied
find: /System/Volumes/Data/Library/Application Support/Apple/Remote Desktop/Task Server: Permission denied
find: /System/Volumes/Data/Library/Application Support/Apple/Remote Desktop/Client: Permission denied
find: /System/Volumes/Data/Library/Application Support/ApplePushService: Permission denied
find: /System/Volumes/Data/Library/Application Support/com.apple.TCC: Operation not permitted

is there any way to ignore those ones?

  • 3
    Just add 2>/dev/null at the end of your find command and you'll not see that output. Oct 9 at 21:09
  • Why do you need to search with find from the root? Oct 9 at 21:25
  • @MarcWilson if I install a software, it may be /usr/local/ maybe /opt, and other place under /, do you think the is any other way to avoid search /?
    – 244boy
    Oct 10 at 2:26
  • Well, if you installed something, you should know where you installed it, why are you having to search for it? Oct 10 at 15:09

First, define a function that can filter out the lines you want omitted. I would suggest the function shown below.

filter() { grep -v -e "No such file or directory" -e "Permission denied" -e "Operation not permitted"; }

Second, use the filter as shown below.

find / -name mywork-process 2> >(filter)

Suggestion: To help prevent searching other mounted volumes, use the -x option, as shown below.

find -x / -name mywork-process 2> >(filter)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .