"find" command examples

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
Line 4: Line 4:
* Find only group-writable files:
* Find only group-writable files:
$ '''find . -type f -perm -020 ! -perm -022'''
$ '''find . -type f -perm -020 ! -perm -022'''
 +
 +
== Notes ==
 +
 +
* '''-perm'''
 +
** If the mask is unsigned, an exact match on the permissions is required.
 +
** If the mask is +, at least one of the bits set must match.
 +
** If the mask is -, all of the bits set must match.

Revision as of 18:06, 5 December 2007

  • Find group-writable or other-writable files:
$ find . -type f -perm -022
  • Find only group-writable files:
$ find . -type f -perm -020 ! -perm -022

Notes

  • -perm
    • If the mask is unsigned, an exact match on the permissions is required.
    • If the mask is +, at least one of the bits set must match.
    • If the mask is -, all of the bits set must match.
Personal tools