While in a directory and you are changing permissions, its really helpful to get a summarized report of all permissions used on the files. If you find a bunch of files have a permission of 777 it might be worth filtering them out and taking a closer look at options of being less permissive.

Summary of permissions

The first command I came up with lists sorts the permissions then gets a count of each type which is useful for looking at the list in order of permissive. The lower number is a lower permission mode (at the top of the list) and the items going down progressively get more permissive.

$ find . -type f -exec stat -c "%a" {} \; | sort

Summary of permissions sorted by count

This is command is pretty much the same as above but with some extra sorting to find the popular type of permissions (sorted by the uniqueness count):

$ find . -type f -exec stat -c "%a" {} \; | sort | uniq -c
comments powered by Disqus