Original find which works in OS X but not now in Ubuntu 16.04find $HOME -type f -name *.tex -exec grep -l masi {} + |  vim -R -(simplified version still; you can omit vim part but it just shows here that I am handling the results)In Ubuntu 16.04, I get those permission denied -messages.I want to exclude permission denied messages from my find; actually those files seem to be mostly .dotFilesdrwx------  2 root root  4096 touko 29 23:59 .gvfsI cannot combine the code to my find of searching. So find all but exclude those files with permission denied (! -readable -prune).Pseudocodefind $HOME -type f -name *.tex \   -o ! -readable -prune -o \      -exec grep -l masi {} + but it seems to expand too much by giving a massive list etc messages grep: /home/masi/.conda/envs/my_root/src/linux-headers-4.2.0-27/include/linux/power: Is a directory`...So different than the thing works in OS X. I tried also unsuccessfully -perm a+r instead of the parsing structure but I still get those permission denied -messages. Reviewing Gilles' answerMy final solution is find $HOME +perm 0666 -type f -name ...because readable is not POSIX and does not work in OSX.  How can you combine search and exclude in find?
find X but exclude these?
find
The answer to the question you asked has to do with boolean algebra and operator precedence. Your find command reads:If it's a regular file, and it's name matches *.tex, then do nothing.Otherwise, if it isn't readable, skip it without recursing.Otherwise run grep.Put the readability test first. This will cause the tests matching the files you're interested in to be attached to the command you want to run on them.find ~ ! -readable -prune -o \           -type f -name *.tex -exec grep -l masi {} + Alternatively, since you seem to be on Linux and OSX, use the recursion facilities of GNU grep.grep -s -r --include='*.tex' -l 'masi' ~You shouldn't have unreadable files in your home directory. Having files belonging to root indicates that you ran some programs as root (probably through sudo) and they left some automatically-generated state files or temporary files behind.~/.gvfs is the root of the GVFS mounting point hierarchy, and it definitely should belong to you, not to root, otherwise GVFS mounts that you try to do (of removable media, network drives, etc.) won't work. Run sudo rmdir ~/.gvfs. If you can't delete it because it's still in use, move it out of the way (sudo mv ~/.gvfs~/.gvfs.root`) and get rid of it when what's currently mounted there gets unmounted.