xon*_*n1c 85 ls permissions macos
如果做一个ls目录中我得到以下的输出:
drwxr-xr-x@ 12 xonic staff 408 22 Jun 19:00 .
drwxr-xr-x 9 xonic staff 306 22 Jun 19:42 ..
-rwxrwxrwx@ 1 xonic staff 6148 25 Mai 23:04 .DS_Store
-rw-r--r--@ 1 xonic staff 17284 22 Jun 00:20 filmStrip.cpp
-rw-r--r--@ 1 xonic staff 3843 21 Jun 21:20 filmStrip.h
Run Code Online (Sandbox Code Playgroud)
我想知道是什么@意思。
Ign*_*ams 80
它表明该文件具有扩展属性。使用ls -l@看他们。
您可以使用xattr来编辑这些属性。xattr -h将为您提供内联帮助。
Bre*_*ode 27
在我的脑海中,我认为这与具有可用扩展属性的文件有关。这是一个类似讨论的链接:
http://discussions.apple.com/thread.jspa?messageID=5791060
因此,如果您在执行 ls 时看到带有“@”的文件,请尝试执行以下操作:
xattr -l <filename>
Run Code Online (Sandbox Code Playgroud)
那应该向您显示扩展属性。
您可以查看 xattr 的帮助以获取更多详细信息:
xattr --help
usage: xattr [-l] file [file ...]
xattr -p [-l] attr_name file [file ...]
xattr -w attr_name attr_value file [file ...]
xattr -d attr_name file [file ...]
The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to attr_value.
The fourth form (-d) deletes the xattr attr_name.
options:
-h: print this help
-l: print long format (attr_name: attr_value)
Run Code Online (Sandbox Code Playgroud)
看起来如果你用“-l”查看额外的属性,然后用“-d”删除它们,它可能会做你想要的。不过,请先在某个临时目录中的某个地方练习此操作,并确保它有效;)
小智 21
从 Mac OS 10.6.1 上的 ls(1) 手册页:
如果文件或目录具有扩展属性,则 -l 选项打印的权限字段后跟一个“@”字符。否则,如果文件或目录具有扩展的安全信息(例如访问控制列表),则 -l 选项打印的权限字段后跟一个“+”字符。
从可用选项列表中:
-@ Display extended attribute keys and sizes in long (-l) output.
-e Print the Access Control List (ACL) associated with the file, if present, in long (-l) output.
Run Code Online (Sandbox Code Playgroud)
这些将使您看到这些扩展选项的价值。FWIW,可以使用您可能已经知道的相同 chmod(1) 实用程序设置 ACL 信息。:-)
从命令行似乎没有一种简单的方法可以使用扩展属性执行任何操作。
小智 9
如果给出 -l 选项,则为每个文件显示以下信息:文件模式、链接数、所有者名称、组名称、文件中的字节数、缩写的月份、文件上次修改的日期、上次修改的小时文件、上次修改的分钟文件和路径名。
此外,对于每个显示内容的目录,目录中文件使用的 512 字节块的总数单独显示在一行中,紧接在目录中文件的信息之前。
如果文件或目录具有扩展属性,则 -l 选项打印的权限字段后跟一个“@”字符。否则,如果文件或目录具有扩展的安全信息(例如访问控制列表),则 -l 选项打印的权限字段后跟一个“+”字符。
用:
ls -la@e
Run Code Online (Sandbox Code Playgroud)
有关具有这些属性/信息的文件或目录的更多信息。
小智 7
“@”表示该文件具有与之关联的“扩展属性”。
如果执行“ ls -@ -l”,则可以查看每个文件的属性。您还可以执行诸如“ xattr -l pgsql.so”之类的操作来转储特定文件的属性。
通常,它们是诸如老式 FinderInfo、文本编码信息或“隔离”信息之类的东西,它为您提供“此文件是从网上下载的,您确定要打开它吗?” 警告。
| 归档时间: |
|
| 查看次数: |
53215 次 |
| 最近记录: |