Take the 2-minute tour ×

How can I get a list of non-writable files within my current directory?

share|improve this question
add comment

4 Answers

up vote 11 down vote accepted

Interpreting that as: user/group/other cannot write

find . -maxdepth 1 -not -perm /ugo+w

share|improve this answer
+1 for -maxdepth 1 –  Aaron Copley May 2 '11 at 19:42
add comment

This find will find files that aren't writable by anyone:

find . ! -perm /222

EDIT: From hmont's suggestion on the comment:

find . ! -perm /222 -exec ls -l {} +

And as Mikey puts on his answer, you can use -maxdepth 1 to limit the find to a single directory.

share|improve this answer
Har! You beat me by 2 seconds, but forgot the 'in the current directory' (along with everybody else). :p –  MikeyB May 2 '11 at 19:32
+1 because it's the clearest one. I would add a -exec ls -l {} \; to provide full information about permissions and owner/group stuff. –  hmontoliu May 2 '11 at 19:34
@Mikey that can be interpreted in many ways :) But your syntax is more readable than mine on the overall. –  coredump May 2 '11 at 19:34
@hmontoliu just to further refine the cmd: instead of "-exec", and since this is linux (vs. solaris et al), you can simply use the faster "-ls" option to find (the format is different, the content is mostly the same): find . -maxdepth 1 ! -perm /222 -ls –  michael_n May 5 '11 at 1:03
@michael_n: good to know –  hmontoliu May 5 '11 at 6:03
add comment

find . ! -perm /a+w
find . ! -perm -ug+w

or some other permutation with symbolic notation to meet your requirements.

To clarify, the '/' will match any user, group, or other. To match all, precede the mode with '-'.

share|improve this answer
add comment
perl -le 'print for grep { ! -w } <*>'
share|improve this answer
add comment

Your Answer


