mai*_*ash 0 linux permissions find grep attributes
是否可以在具有特定扩展属性的 linux 操作系统中搜索文件,如下所示: ---S--l---
---S--l--- 1 root root 0 Mar 1004:25/opt/csTuner/iba/wys/tuer_lolk
Run Code Online (Sandbox Code Playgroud)
权限中的S是什么:
S - 更改同步写入磁盘;这相当于应用于文件子集的“同步”挂载选项。
我的目标是搜索同步写入磁盘的文件。
find
无法自行搜索文件属性(这是权限之外的其他内容!)。
单程:
find /location -type f -print0 | xargs -0 lsattr | grep '^...S'
Run Code Online (Sandbox Code Playgroud)
在我的系统上,S
是在lsattr
输出的第三列,所以为了让它更灵活,我们可以使用更复杂的正则表达式:
find /location -type f -print0 | xargs -0 lsattr | grep '^[^ S]*S[^ S]* '
Run Code Online (Sandbox Code Playgroud)
grep '^[^ S]*S[^ S]* '
应该在哪里找到S
第一列中有 的任何内容。
归档时间: |
|
查看次数: |
1359 次 |
最近记录: |