Search code examples
unixfile-attributes

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


I noticed I have one file that looks like this when I type ls -lah in the terminal:

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

I was just curious as to what the @ symbol means? I presumed it's a file attribute but I googled it and couldn't find any reference to it.


Solution

  • Since you're tagged unix, the controlling standard that applies to all Unixen is IEEE 1003.1. Quoting from same:

    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>.

    Thus, this tells us that there is "an alternate or additional access control method associated with the file". Typically, this is something like an ACL, which a command like getfacl (on a Linux system) may retrieve and view.


    Specifically for MacOS, however, the documentation ls specifies that presence of xattrs is shown with this character. Quoting from its man page:

    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.

    Thus, on MacOS, presence of ACLs is indicated with @, and ACLs are represented with +.