查找不属于组的文件


13

如何查找不属于特定组的文件?

find /home -group NOT test

Answers:


20

find /home -not -group test 要么 find /home ! -group test

惊叹号会使比赛倒数。来自man find

 ! expr True  if  expr  is false.  This character will also usually need

 -not expr
          Same as ! expr, but not POSIX compliant.

如果您希望该组确实属于输出:

find /home ! -group test -printf "%p:%g\n"
./lots/573:root
...

有关使用find的更多信息:
如何掌握UNIX find命令?


+1-不知道你能做到。
戴夫·霍兰

+1 –好招,也不知道这是一个选择...:]
凯尔·史密斯

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.