I do in Posix find $HOME +perm 0666 -type f -exec grep -l "XSym" {} \;
but get this which I do not understand
find: ‘/home/masi/.dbus’: Permission denied
grep: /home/masi/.viminfo: Permission denied
grep: /home/masi/.cache/dconf/user: Permission denied
since
drwx------ 3 root root 4096 Jun 18 14:49 .dbus
-rw------- 1 root root 6266 Jun 18 13:24 .viminfo
-rw------- 1 root root 2 Jun 18 14:51 /home/masi/.cache/dconf/user
I do not like double negation structure and non-Posix things like ! -perm -g+r,u+r,o+r -prune
here which I think is equivalent to ! -perm 0444 -prune
.
Proposal after Kusalananda's fix
I do
# http://unix.stackexchange.com/a/121020/16920
find / -type d \! -perm 0666 -prune -o -type f -name '._*' -print
Output: no files. Expected output: many files with many appropriate files. I run
find / -type d \! -perm +0666 -prune -o -type f -name '._*' -print
I get
find: invalid mode ‘+0666’
System: Ubuntu 16.04 64 bit
Grep: 2.25
Find: 4.7.0-git
0444
overu+r,g+r,o+r
but in your command you didn't prune anything. There's no-prune
in it. The pruning is what makes it skip the things you can't read. Also,+perm
is definitely not right. It's always-perm
. In some versions of find,-perm +0666
would be a valid predicate (though maybe not the one you want) – Jun 19 '16 at 21:42-perm +000
is deprected since 2005, that's why you get invalid mode ‘+0666’... use-perm /000
instead. – DJCrashdummy Nov 23 '19 at 22:11-perm 000
(only lists absolutely exact matches),-perm -000
(list matches with at least all specified rights) and-perm /000
(lists matches with also only matching one of the specified rights). perhaps that's why you get no files as output by using-perm 0666
. – DJCrashdummy Nov 23 '19 at 22:13