• [Linux]find命令与 perm 的 + 号


    看例子:

    root@debian01:~# cd test
    root@debian01:~/test# ls
    root@debian01:~/test# touch aaa
    root@debian01:~/test# touch bbb
    root@debian01:~/test# touch ccc
    root@debian01:~/test# touch ddd
    root@debian01:~/test# chmod 6000 aaa
    root@debian01:~/test# chmod 2000 bbb
    root@debian01:~/test# chmod 4000 ccc
    root@debian01:~/test# chmod 6600 ddd
    root@debian01:~/test# find ./ -type f -perm 6000
    ./aaa
    root@debian01:~/test# find ./ -type f -perm -6000
    ./ddd
    ./aaa
    root@debian01:~/test# find ./ -type f -perm +6000
    ./ccc
    ./bbb
    ./ddd
    ./aaa
    root@debian01:~/test# 

    -perm 后面不带 + 也 不带 - ,就是 完全匹配。

    -perm 后面带 -, 就是说 包含了此mode的(比它宽泛的),例如 6600 包含了 6000。

    -perm 后面带 +,就是此mode,或者被此mode包含的。

                              例如 6000,拆为二进制后变成:110 000 000 000,

                               6600 为:                             110 110 000 000,

                               4000 为:                             100 000 000 000

                               2000 为:                             010 000 000 000

                              和600 的非零段位与运算后,得到的都是非零值。所以都符合查询条件。

    结束

  • 相关阅读:
    Django入门
    Python从入门到放弃
    Python中的元类(metaclass)
    蓝鲸gse启动失败
    VS2019添加微软ReportViewer
    DevExpress WinForms各版本与 .NET、Visual Studio 的版本兼容性
    SQL语句查询每个分组的前N条记录的实现方法
    如何查看Windows安装版本号
    学习webpack
    Python3.x将代码打包成exe程序并添加图标
  • 原文地址:https://www.cnblogs.com/gaojian/p/2876046.html
Copyright © 2020-2023  润新知