What does the @ mean on the output of "ls" on OS X' terminal?

When doing an ls in a directory I get the following output:

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

I was wondering what the @ means.


Solution 1:

It indicates that the file has extended attributes. Use ls -l@ to see them.

You can use xattr to edit these attributes. xattr -h will give you the inline help for it.

Solution 2:

Off the top of my head, I think is has something to do with the file having extended attributes available. Here's a link to a similar discussion:

http://discussions.apple.com/thread.jspa?messageID=5791060

So if you see a file with an "@" when you do an ls, try doing this:

xattr -l <filename>

That should show you the extended attributes.

You can check xattr's help for more details:

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)

It seems like if you look at the extra attributes with "-l" and then remove them with "-d" it'll probably do what you want. Practice this in a temporary directory somewhere first though and make sure it works ;)

Solution 3:

From the ls(1) man page on Mac OS 10.6.1:

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.

From the available options list:

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

These will let you see the value of those extended options. FWIW, ACL info can be set using the same chmod(1) utility you are probably already aware of. :-)

There doesn't appear to be an easy way from the command line to do anything with extended attributes.