unix中文件属性旁边的@是什么意思?

What does @ mean next to the file attributes in unix?

当我在终端中键入 ls -lah 时,我注意到我有一个看起来像这样的文件:

-rw-r--r--@    1 bj5  1704   2.3M 13 Mar 16:12 All_Metadata.csv

我只是好奇 @ 符号是什么意思?我认为它是一个文件属性,但我用谷歌搜索并找不到任何对它的引用。

由于您被标记为 unix,因此适用于所有 Unixen 的控制标准是 IEEE 1003.1。引用自:

The file mode written under the -l, -n, [XSI] [Option Start] -g, and -o [Option End] options shall consist of the following format:

"%c%s%s%s%s", <entry type>, <owner permissions>,
    <group permissions>, <other permissions>,
    <optional alternate access method flag>

The <optional alternate access method flag> shall be the empty string if there is no alternate or additional access control method associated with the file; otherwise, it shall be a string containing a single printable character that is not a <blank>.

因此,这告诉我们有"an alternate or additional access control method associated with the file"。通常,这类似于 ACL,getfacl(在 Linux 系统上)这样的命令可以检索和查看。


但是,文档 ls 专门针对 MacOS 指定 xattrs 的存在与此字符一起显示。引用其手册页:

If the file or directory has extended attributes, the permissions field printed by the -l option is followed by a '@' character. Otherwise, if the file or directory has extended security information (such as an access control list), the permissions field printed by the -l option is followed by a '+' character.

因此,在 MacOS 上,ACL 的存在用 @ 表示,ACL 用 + 表示。

“@”符号表示该文件具有扩展属性。您可以使用命令 'xattr -l ' 来显示它们。好像很多Finder的信息,本来应该放在目录里的,现在都在扩展属性里了。