command line – List all files in all subdirectories NOT having specified file permissions – Education Career Blog

I need to see all files (with full pathname), along with their file permissions, on a folder which DO NOT match

-rw-r--r--

This didn’t work as I thought it should have:

#ls -laR | grep --invert-match '-rw-r--r--'
grep: invalid option -- -

,

You need to backquote all -:

#ls -laR | grep --invert-match '\-rw\-r\-\-r\-\-'

,

find . -maxdepth 1 \! -perm 0664 -printf '%M\t%P\n'

Modify format string as desired.

,

ls -laR | grep -- "-rw-r--r--"

but you really should use GNU find.

Leave a Comment