Search code examples
bashmacosls

What does @ in `-rw-r--r--@` mean in the `ls -l` output?


I was examining output of ls -l in by bash completion folder on Mac OS X

$ ls -alrth /usr/local/etc/bash_completion.d/docker-machine* 
-rw-r--r--@ 1 abhimskywalker  staff   1.4K Jun 13 19:04 /usr/local/etc/bash_completion.d/docker-machine-prompt.bash
-rw-r--r--@ 1 abhimskywalker  staff   1.5K Jun 13 19:36 /usr/local/etc/bash_completion.d/docker-machine-wrapper.bash
-rw-r--r--@ 1 abhimskywalker  staff   6.8K Jun 13 19:37 /usr/local/etc/bash_completion.d/docker-machine.bash

I could not understand what does this @ mean in -rw-r--r--@?


Solution

  • It indicates that the file has extended attributes. You can use the xattr command-line utility to view and modify them:

    xattr -l file # lists the names of all xattrs.
    xattr -w attr_name attr_value file # sets xattr attr_name to attr_value.
    xattr -d attr_name file # deletes xattr attr_name.
    xattr -c file # deletes all xattrs.
    xattr -h # prints help
    

    You can also use ls -l@ to see more information about those extended attributes.

    From the osx ls man page:

    The Long Format
    If the file or directory has extended attributes, the permissions field printed by the -l option is followed by an @ character. Otherwise, if the file or directory has extended security information, the permissions field printed by the -l option is followed by a + character.

    And

    -@ Display extended attribute keys and sizes in long (-l) output.