I need to find all the files that have group Read or Write permission or files that have user write permission.
This is what I have so far:
find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}'
It shows me all files where group read = true, group write = true and and user write = true.
how do I make it show me where group read = true, OR group write = true OR user write = true?
Thanks!
find . \( -perm -g=r -o -perm -g=w -o -perm -u=w \) -ls
joeyg
October 20, 2008, 4:36pm
3
Three finds
'/-...r...../ {
'/-....w..../ {
'/-.......w./ {
all to a workfile, then so a | sort -u (in case of duplicates)
you can use this one.. may be u need to modify some part
ll | tr -s ' ' | awk '{ perm=$1; dd=substr(perm,2,3); de=substr(perm,5,3); if (dd == "rw-" && de == "r--" ) print $9 }'
I decided I didnt want to see anythink that was a link ( only files and directories).
I also wanted it sorted by the directory name which I put in the 4th column of my output file.
Here is what I ended up with:
find . -type d \( -perm -g=w -o -perm -o=r -o -perm -o=w \) -ls | awk '{print $3 " " $5 " " $6 " " $11}' > /home/shunter/findperm.tmp
find . -type f \( -perm -g=w -o -perm -o=r -o -perm -o=w \) -ls | awk '{print $3 " " $5 " " $6 " " $11}' >> /home/shunter/findperm.tmp
cat /home/shunter/findperm.tmp | sort -k4 > /home/shunter/findperm.txt
rm /home/shunter/findperm.tmp
Thanks for your help!
find . -perm +260
+ perms will use the 'or' operator.
2 user write,
6 group read or write
0 no special conditions for others.