How do I perform a file search in linux based on file permissions?
-
Also see:
Man page for find.
To understand permissions, see Wikipedia on chmodThis could be a long list, terminate the output using
Ctrl-C
-
means all the bit sets are required for the match.Assuming just the current directory for the find.
Find files writable by others.
$ find -perm -002 ./filex ./filea
Find files readable by everyone.
$ find -perm -444 . ./.filed ./filex ./filea ./.filec ./test ./test/perf ./fileb
Find files not readable by everyone.
$ find ! -perm -444 ./int
Handy to list the files sometime along with the
-perms
option.$ find ! -perm -444 -ls 237412 1 -rw------- 1 trainer trainer 0 Nov 14 11:45 ./int
An exact permission file search.
$ find -perm 600 -ls 237412 1 -rw------- 1 trainer trainer 0 Nov 14 11:45 ./int
© Lightnetics 2024