wim*_*wim 3 permissions file-permissions macos
如何获得文件的八进制权限?
/tmp$ ls -al myfile
-rw-r--r-- 1 wim wheel 0B Oct 20 22:31 myfile
/tmp$ the_command myfile
644
Run Code Online (Sandbox Code Playgroud)
尝试了我在其他答案中找到的建议,但没有奏效:
/tmp$ stat -c "%a %n" myfile
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
Run Code Online (Sandbox Code Playgroud)
获得的新信息(和更短的信息):stat -f '%A' <filename>
您还可以*用于所有文件和文件夹。如果您需要更好的格式,您可以使用
stat -f '%A %N' <filename>它将显示八进制权限和文件名。
信用:
https : //askubuntu.com/a/152003 - 检查这个答案的第一条评论
http://geeklog.adamwilson.info/article/58/getting-file-permissions-in-octal-on-OS-X
编辑添加:要检查您的结果,请尝试运行stat -f "%Sp %OLp" <filename>,这将为您提供 --rwxrwxrwx 样式 + 八进制版本
| 归档时间: |
|
| 查看次数: |
1283 次 |
| 最近记录: |